On both Mac and iOS, how can I search for drafts with no content. That is, drafts that appear in the drafts list as --blank–? Thank you.
What do you want to do with the blank drafts?
If it is just remove them, then the ThoughtAsylum - Management action group has an action to put blank drafts in the trash (TAD-Blank Drafts to Trash
).
If you need to do something else with such drafts, you could review the TADpoLe function the action uses to do the trashing.
Function: TA_trashEmptyDrafts()
// Send all empty drafts to the trash.
Draft.prototype.TA_trashEmptyDrafts = function()
{
//Initialise
let intCounter = 0;
let adraftAll = Draft.query("", "all", []);
//Work through all the drafts in turn
adraftAll.forEach(function(anotherDraft)
{
//Find drafts that have no content and are not already trashed
if (anotherDraft.content.length == 0 && anotherDraft.isTrashed == false)
{
//Keep a count for the info message
intCounter += 1;
//Trash the draft
anotherDraft.isTrashed = true;
anotherDraft.update()
}
});
//Info messages on what was found and done
if (intCounter == 0)
{
app.displayInfoMessage(`No blank drafts were found`);
}
else
{
if (intCounter == 1)
{
app.displayInfoMessage(`1 blank draft was moved to the Trash`);
}
else
{
app.displayInfoMessage(`${intCounter} blank drafts were moved to the Trash`);
}
}
return intCounter;
}
Hope that helps.
1 Like
You can use regular expression search to find empty drafts. Use /^$/
in the search field.
3 Likes
Thank you sylumer. Removing them is what I wanted to do. I’ll take a look at that action. Thanks!
Thank you for the regular expression for this.