Using DEVONThink with Drafts?

I realize this might be best for the DT forums, but I thought I might try here first.

As a science student who is working on publications and preparing for a huge senior thesis paper, I have been using and loving DT for over a year now. However, one of my main problems with it is its lackluster text editor. It is unpleasant and inefficient to draft notes or text files directly in DT for me.

One idea I had was basically to use Drafts as my text editor for DT (especially now that it’s on the Mac!). There is a Drafts action that sends a draft to the DT inbox and I use a keyboard shortcut to paste the link to any DT item into my draft. This is handy when I am taking notes on a paper I’m reading and I want to link to that paper so that the note and paper are connected. I’m now currently brainstorming other ways Drafts and DT might be integrated.

For those with experience in Drafts and DT, any ideas?
Anyone else find ways around DT’s lackluster text editor?

You might want to take a look at Gabe Weatherhead’s Moving Text Between Drafts and DEVONthink To Go with Shortcuts.

I’ve been using this process to edit text documents on iOS in Drafts that are stored in DEVONthink.

As for the Mac, I use BBEdit for all my text editing, so I have a Keyboard Maestro action to map ⌘O to ⇧⌘O which opens documents in the external editor, which is BBEdit. In DT3 you can set double clicking a document to open in the external app in Preferences > General > Interface > Double click opens documents externally

1 Like

If I understand correctly, Gabe Weatherhead’s Shortcuts solution exports the DevonThink document into Drafts, and then re-imports the changed document into DevonThink.

A better solution, I think, is to use DT’s ability to act as a document provider, and edit the document in place. IA Writer works for that. So does 1Writer. I expect there are other solutions too.

A still better solution, IMO, and the one I use: Write on a Mac. :slight_smile:

1 Like

Good tip. This works with any editor that does not move the document into a proprietary data store accessible only by that editor – which is what Drafts on macOS does, which is cumbersome and not useful. Apps like BBEdit, Typora, Multimarkdown Composer, and similar, just open the document directly from inside the DEVONthink 3 database and save it back there without fuss.

(BTW, not necessary to use KM to map ⇧⌘O to ⌘O – just use System Preferences > Keyboard > Shortcuts > App Shortcuts to create the shortcut.

So, this set up in System Preferences > Keyboard > Shortcuts > App Shortcuts:

results in this in the DEVONthink Open With submenu:

Screenshot%20of%20DEVONthink%203%20(6-30-19%2C%201-58-16%20PM)

Just generally, the App Shortcuts settings in System Preferences can apply a shortcut to anything that appears in the DEVONthink Open With menu – that’s the way App Shortcuts works.

1 Like

Hmm, I hadn’t considered this problem with Drafts. Because I already use Drafts for a lot of other stuff, I was hoping I could just extend itsuse to my general text editor on DT. I will look into BBEdit and others!

Before iOS came out with document providers, DEVONtech came up with a smart solution for editing text files in outside apps, via a file name code.

The Shortcuts/Drafts actions takes the current file then exports it to Drafts, once you are done editing, it imports the text back into DEVONthink, updating the original file.

I for one, prefer Drafts over almost any other iOS text editor due to actions, so this has been hugely beneficial to me.

2 Likes

I’m going to have to look into this. Thanks!

Well I probably am missing something very obvious, but as I am starting my DevonThink “experience” for the first time, I am going through the DevonThink Field Guide (which is superbly crafted and seems very thorough), I ran into a small snag. I use Drafts a great deal and one DT use case is to better manage and access my Drafts thoughts. David mentions a Draft Action which (after the past hour looking I probably should try to cobble together myself rather than looking further) posts a Draft with tags to DT. Perfect as I tag my Drafts and this would be key during the migration/import. David said he posted the Action to the Drafts Directory (darned if I can find it!). I even looked in the Drafts Field Guide in case he placed it there, no joy as far as I can see. I realize it shouldn’t be all that complicated to put together myself, but I thought I would give a quick post here before going down that rabbit hole. Thanks in advance for your help and assistance with this issue. I hope you have a wonderful day!

A couple of preliminaries to set the stage for these Drafts → DEVONthink actions.

To make the first action work, I have this setting for DEVONthink Preferences > Files > Import. The effect of the setting is that DEVONthink prompts me for a destination for anything I import via Drafts or other app extensions.

Second, in the case where I want to import from Drafts into a specific group, I gather that group’s Item Link by opening the contextual menu in DEVONthink with the group selected and choosing the Copy Item Link suggestion.

1. Send from Drafts as markdown and get prompted for destination

x-devonthink://createMarkdown?title=[[title]]&text=[[body]]

You can modify this command by replacing createMarkdown with one of these values:

createFormattedNote: Creates a formatted note.
createHTML: Creates a new HTML document.
createMarkdown: Creates a Markdown document.
createPDF: Creates a PDF.
createRTF: Creates a rich text document.
createWebArchive: Creates a web archive.
createBookmark: Creates a new bookmark.

2. Send to a specific group

x-devonthink://createMarkdown?&title=[[title]]&text=[[clipboard]]&destination=D80F5A23-5851-4D64-A776-5256D8F3E147

Replace the value after destination= with the UUID portion of the destination group’s Item Link.

3. Modifying the draft before posting to DEVONthink

For any of the above, you can re-format the Drafts note by adding a Clipboard step before the action that calls the x-devonthink URL. For example, I sometimes use this Clipboard action in Drafts actions, to add a mod date and table of contents to a markdown note I’m sending from Drafts to DEVONthink.

## [[title]]

[[modified|Modified: %B %d, %Y %H:%M:%S]]

\{{TOC}}

[[body]]

1 Like

Thank you for your response. Will these actions also transfer Drafts tags into DT? I like the modification to amend a date and time to the entry.

If you insert

&tags=[[tags]]

into the DEVONthink URL, then tags will be transferred to DEVONthink. Such as

x-devonthink://createMarkdown?title=[[title]]&text=[[body]]&tags=[[tags]]
1 Like