Add to an existing document in DEVONThink

#1

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?

#2

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.

#3

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.

#4

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:

#5

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
#6

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.

#7

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.

#8

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

1 Like
#9

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

#10

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
#11

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?

#12

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
#13

John that worked!

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

#14

Great. Pleased to have been able to help.

#15

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
1 Like
#16

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.

#17

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.