Multiple Item Transfer to DevonThink

I am looking for a solution which would allow me to send multiple DRAFTS TO Devonthink (with tags) via a Drafts Action. The Action I found on the forum works well on a single Draft. Unfortunately, I have a rather large number of Drafts which will have more utility as part of Devonthink.

Can a pause be built into the script to allow the callback and run this script against multiple Drafts? Alternatively, could I cobble something together via Keyboard Maestro? I would have to call the action, pause, iterate/loop through a workspace of Drafts.

Can anyone provide some insight or inspiration? Thanks in advance for your help and assistance with this matter! I wish you all a blessed and happy holiday season!

If you have an action configured the way you like, you can select multiple drafts in the draft list and use the “Run Action” command in the contextual menu (right-click) on the draft list to get Drafts to run that action sequentially on each draft.

There are some actions that will not work with, but most work fine.

an action which can handle the “Run Action” option agiletortoise mentioned is this one: Markdown to DEVONthink CB | Drafts Directory
I just shared it to the directory :slight_smile:

If you want to do further automation (e.g. because you always want to use the action with the same tags this could be scripted relatively easy. But to support that a more detailed description of your usecase would be good

  • do you want to run the action and it should always search for drafts with the same tag and add them to devonthink?
  • is markdown the format you are using?
  • do you want to keep the drafts the action shared to DEVONthink in the Drafts app afterwards or do you want to delete them?

Thank you for taking the time to respond! The Action I have been trying to adopt is in the Directory (Send to DEVONthink | Drafts Directory) When running this against more than one Draft I receive this error:

The action “Send to DEVONthink with Tags” cannot be run as a batch operation on multiple drafts. It contains URL action steps which may leave the app and not return to allow the operation to be continued. This action must be run on only one draft at a time.

I’ve also tried using send to DevonThink and 2Do (as I am also a 2Do user). But no tags are included and the 2Do Action isn’t working for me at all.

I installed the action you provided but running this on even one Draft returns a different error:

Invalid URL in generated by URL step template.

I am able to run a wide variety of other actions with no (or easily enough understood) issues except for to my DT install…

I am tagging Drafts with “devonthink” as a filter for those ideas and links I know at the time I am entering them into Drafts need a more permanent home in one of my DT databases.

I appreciate your effort to be of help. I intend to keep looking and experimenting until I get to the bottom of this as the Drafts to DT (and/or 2Do) workflow will be beneficial over the long term.

In order to be chainable, the DEVONThink action would need to use a Callback URL action step, not a URL step, as it allows Drafts to wait for completion of the action. DEVONThink supports callbacks, so should be no problem.

If you modify the “Send to DEVONThink” example you posted, add a new “Callback URL” step, copy and paste the URL from from the existing “URL” step, to the “Callback URL” step, then delete or disable the “URL” step, it should allow you to run it in sequence on multiple drafts.

Make sure the Callback step is set to “Wait for Response” (which is the default).

If you get that working, it would not be hard to write a separate action that looped over all drafts with the devonthink tag in the inbox and processed them without having to select them.

Never seen that error.
Do you see this error in the action log with more information?

In the DEVONthink 3 documentation for URL commands it says the following:

Note: These are not x-callback-urls. An x-callback-url is a specific type of URL scheme that returns a value to the calling application.

When I tried the x-callback action it just timed out. So I would assume that they are not valid. At least, not on the Mac.

Based on that result, I put together a quick (read quick & dirty) AppleScript version that just takes the current draft and puts it into the current database/group. It isn’t using a safe title for the name, just the title, but DEVONthink seems to take care of that when creating the Markdown file on disk, and it still shows in the DEVONthink UI with the correct name.

Hope that helps.

1 Like