Add to an existing document in DEVONThink

Hi I am using drafts to send notes to a specific location in DEVONThink and it is working really well, I am very happy. I also have actions that add drafts to existing documents in Dropbox to create running records of ideas, observations etc and would like to do the same thing in DEVONThink. Is there any way to append/prepend drafts to existing documents in DEVONThink?

Iā€™ve not yet seen anything to suggest that you can append to an existing file. The most comprehensive list of available URL scheme based actions is in a MacStories article.

But as far as I know, macOS DEVONThink (DT) is capable of adding folders of data and presumably if there was a file in such a folder that you append to, then the system would pick up the update. If you have an always on Mac, Drafts could append to a file on that and DT could pick up the change.

Thanks for the quick response. I had trawled through the manual, this forum and the MacStories posts and drawn a blank. Thanks for confirming I donā€™t seem to have missed anything. I think I will just stick to maintaining those files in DropBox and maybe setting a reminder to regularly copy across to DEVONThink.

Youā€™re welcome, but I would note that I canā€™t say Iā€™ve carried out an exhaustive confirmatory search. Whilst Iā€™d agree weā€™ve both drawn a blank, so far, on this one, thereā€™s always a chance someone else may yet have a more satisfactory answer :slight_smile:

DEVONthink has a pretty extensive URL scheme. One of that is a url scheme to modify the content of a DEVONthink document by appending text. Itā€™s detailed in the app help (Appendix > URL Commands).

1 Like

Thanks, not sure how I missed that. It isnā€™t obvious what the distinction is between update and append but I am sure a bit of experimentation will make everything clear.

Having thought about this after my original post I believe I now have three options:
The existing use of Dropbox
Using a list action and stay entirely with Drafts
Using a url action to transfer to DEVONThink

It is great to have a choice.

Thanks again for the steer.

Added an hour or so later- I have tested appended and it works! Update replaces the existing document with the current draft, logical really.

Thanks again for the help.

maybe this is interesting for you, too - especially if you decide to ā€œstay entirely with draftsā€.
Maybe I missunderstood you, but I thing you want to add something to a list in a document.

Thanks. I already have a lists action which works well but I have downloaded your action to show lists, neat.

1 Like

Would you be willing to share your action that sends items to specific locations in DevonThink? I have two locations I would routinely send to.

I tried one script that allows this, but the URL needs to be entered each time, and I was looking for one I could modify to always send to the same location.

Thanks

This url sends the draft as a markdown document to a specific location, replace ā€œuuidā€ in the url with your specific location reference, and has the date and first line as the title and the draft as the document:
x-devonthink://x-callback-url/createmarkdown?title=[[created]]_[[title]]&text=[[draft]]&destination=uuid&x-success={{drafts5://}}&x-cancel={{drafts5:}}

You can send plain text by modifying createmarkdown.

Hope that helps.

2 Likes

Thanks for sharing your action with me. I tried to use it to send to a specific folder within a DevonThink database, but it keeps going to my Global Inbox. The action is as follows:

x-devonthink://x-callback-url/createText?title=[[created]]_[[title]]&text=[[draft]]&destination=ā€˜x-devonthink-item://620742A8-D357-4AEE-BD64-9596D67B8F67ā€™&x-success={{drafts5://}}&x-cancel={{drafts5:}}

I tried several different syntaxes with the destination, but nothing seems to work for me.

Also, I am using DevonThink 3 and am not sure that has any bearing on this.

Any ideas as to what I am doing wrong?

Try this

x-devonthink://x-callback-url/createText?title=[[created]]_[[title]]&text=[[draft]]&destination=620742A8-D357-4AEE-BD64-9596D67B8F67&x-success={{drafts5://}}&x-cancel={{drafts5:}}

1 Like

John that worked!

Thanks so much for the help on this. It will really simplify my workflow for the folders I have in DevonThink.

Great. Pleased to have been able to help.

Minor point, depending on your use case, but if you are working with an app that supports x-callback-url, itā€™s best to use a CallbackURL action step, in place of an Open URL step.

This has several advantages:

  1. Drafts will add the x-cancel, x-error, x-success parameters for you.
  2. If the app returns any values when returning to Drafts, Drafts will make those results available to scripts and further action steps (see docs for details).
  3. Drafts can wait for a response from the target app before continuing. This allows the action to be compatible with running as a batch operation on multiple drafts (using Select > Operations > Run Action in the Draft list).

In this case it would be the same URL template suggested above, just without the x-callback parameters, like:

x-devonthink://x-callback-url/createText?title=[[created]]_[[title]]&text=[[draft]]&destination=620742A8-D357-4AEE-BD64-9596D67B8F67
2 Likes

Great, thanks for taking the time to flag this and the advantages to be had. I feel I am always learning and the effort usually pays off. Great app.

Thanks for the tip. I just replaced about 15 actions with the new CallbackURL and it works great on multiple items. I thought that the encryption in DevonThink would be a problem but it does not appear to be.