Process Drafts in INBOX Action

Hi,
I made an action which for me is one of the most useful ones in the last days.
I store pretty much everything text related in drafts.
To quickly sort it out i have a few actions (in different action groups) I normally run on them).
To speed this up I created an action which loops through the drafts in my INBOX workspace and asks me for each of them what to do. I can select actions from a prompt and they will be enqueued and run after processing all drafts in the INBOX.
You can customize it easily by simply adapting the name of your INBOX workspace and inserting the names of your actions you run on the most drafts. I use different „display names“ in the prompt, than the name of the action itself which is defined at the beginning of the action.
If you find it useful or have any questions just comment below.
Download the action from the Action Directory

3 Likes

Great action and great documentation.

I will definitely find that useful.

The idea of an Inbox workspace is really neat

thanks :slight_smile:

actually the “Inbox workspace” was a TIP in the forum here

I am getting an error in Line 29:

And this is the scrip, all I did is edit the actions labels and names, deleted 2 of them

// created by @FlohGro

// process drafts from INBOX
// ----------------------------------------------------
// START OF USER DEFINITIONS

// define the name of your inbox workspace
let inboxWorkspaceName = “INBOX”;

// declare “display names” (for the prompt) and “action names” (from your Actions) in an array:
// the last pair does not need a “,” after the [] brackets!s
let actionArray = [
[‘skip’, ‘’],
[‘:white_check_mark: iAwriter’, ‘INBOX line’s’],
[‘:link: Notes’, ‘Create note in Notes’],
[‘:card_index_dividers: DEVONthink’, ‘Send to DEVONthink’],
[‘:wastebasket: trash’, ‘trash’]
// [’’, ‘’],
// [’’, ‘’],
// [’’, ‘’],
];

// END OF USER DEFINITIONS
// ----------------------------------------------------

let actionMap = new Map(actionArray);
// - get drafts from INBOX Workspace
let inboxWorkspace = Workspace.find(inboxWorkspaceName);
let inboxDrafts = inboxWorkspace.query(“all”);

// loop through every draft (show title and prompt for action on it)

for (inboxDraft of inboxDrafts) {
let actionPrompt = new Prompt();
actionPrompt.title = “process draft”
actionPrompt.message = "draft: " + inboxDraft.displayTitle;

// add button for all elements in the actionMap

actionMap.forEach(function(value, key) {
actionPrompt.addButton(key, value);
})
actionPrompt.isCancellable = false;
actionPrompt.show();

let selectedAction = actionPrompt.buttonPressed;

if (selectedAction == ‘’) {
// no action for the given name
} else {
let action = Action.find(selectedAction);
app.queueAction(action, inboxDraft);
}

}

Can you confirm that you have a workspace called “INBOX” as specified by the first jon-comment line?

Also, it helps to put your code between triple back ticks to avoid the forum converting some of the characters (e.g. smart quotes) and destroying the formatting.

```
//Put your code here
alert("hello world");
```

Then becomes

//Put your code here
alert("hello world");

Instead of

//Put your code here
alert(“hello world”);

1 Like

Your code in the thread is full of wrong characters for ‘ Could you repost it?