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
Great action and great documentation.
I will definitely find that useful.
The idea of an Inbox workspace is really neat
thanks
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â, ââ],
[â iAwriterâ, âINBOX lineâsâ],
[â Notesâ, âCreate note in Notesâ],
[â DEVONthinkâ, âSend to DEVONthinkâ],
[â 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â);
Your code in the thread is full of wrong characters for â Could you repost it?
This is an awesome action. I have taken the liberty and made some modifications to work with my own situation:
- added a dialog to let the user choose a workspace before executing this action
- only process the actual âinboxâ items in the chosen workspace, so if you ever need to run this action again in the same workspace, no drafts in the archive/trash will be processed.
I have shared it in the directory: process Drafts in workspace | Drafts Directory
and you can see the code at: GitHub - HybridRbt/process-drafts-in-inbox-modified: a customized version of the Drafts action by @FlohGro: https://actions.getdrafts.com/a/1ch
Is there any way to add a âcancelâ option for this action? I ran into a situation where I was testing the action and realized I couldnât bail without tapping âskipâ multiple times.
updated the action in the directory with a CANCEL button at the top:
Thank you for the quick addition! Iâm trying to see if this script or your âon my mindâ is a better fit for how I work.
Sure glad to help!
Iâm mostly using the On My Mind now since I often have just quick thoughts which I add to the on my mind draft and then process them later. I donât see the inbox count for the On My Mind draft which is better for me and I can use the inbox count more precisely:)
Just look what fits for you