macOS: Running action on multiple drafts – bug or feature?

When I select multiple drafts in the draft panel on the left and then click a simple text replacement action in the action panel on the right, I would expect this action to change every draft immediately. However, it only changes one draft, so a click on the action is necessary for every selected draft. Is this intended behaviour?

That is by design. The actions in the action list (and action bar) are performed on the draft loaded in the editor.

If you wish to run an action on multiple selected drafts on the Mac, use the Run Action... command in the contextual menu of the draft list.

2 Likes

If I have two drafts selected and run an action with an Insert Text step, what I get is the same text inserted twice in the first draft. (This is on Mac.)

Perhaps I could tackle this with scripting? Except I can’t find a way to retrieve the list of currently selected drafts.

There are different types of action steps and scripts, which interact with elements in Drafts differently.

In the case of “Insert Text”, it is designed to work with the editor. So it always is inserting text at the current cursor position in the draft currently loaded in the editor. When you “run action” on multiple drafts from the draft list, each draft is in context for the action, but it does not explicitly load them in the editor.

I’m not sure exactly what your end goal is…there are many ways to construct actions that will work better with running them on multiple drafts in this way. If you explain what you are trying to accomplish, I’m sure we can help sort that out in an action.

Sure, and happy to open a new thread if that would be preferable.

I’m working on exporting my drafts out to my file system (not unhappy with Drafts, just cleaning up), and before I do I want to insert some metadata about each one (like created date) into the top. I don’t just want to bulk run the same action on all my drafts though, as there’s some manual touchup to do on many of them. I was hoping I could select a few at a time, run the action, export, then do the next batch, etc.

I would suggest you configure a “File” action (or Dropbox, or similar action step) to write the files the way you want. There’s no need to alter the content of the draft, each of those steps to write to files has template that control the file naming and content of the file. You can insert drafts tags in those templates. Once you have an action that writes out the file with the addition content you desire, it will work fine with the multiple selection > Run Action method.

Hey, thanks. This is working well for some clusters of drafts that are relatively uniform in nature. I’ve also found I can use workspaces to narrow down lists of drafts to operate on when scripting.

There seems ot be a small bug with notifications. After running an action on many drafts (175 in the most recent case), a few of the notifications fired, but most didn’t. They fired after I ran a separate action, almost as if it cleared some kind of logjam in a queue. Certainly an edge case; still wanted to report it.