Tip: Appending Clipped Text to Docs with Keyboard Maestro

While DEVONthink has a nice Service command to append Rich/Plain notes to the last captured note, I often find myself wanting to append a selection of text to specific project note files. I was inspired by this Brooks Review blog post and this blog post on IskoSalminen.com to create a solution in DEVONthink.

You will need to customize the macro by pointing it to your text file where you want to clip the text-do this by selecting the document in DEVONthink, right-click, and select ‘Copy Item Link’ and then paste this URL into the macro’s Open URL field. Note that this field appears TWICE in the macro-you’ll need to make sure you have the same document URL entered in both places. Once the macro is set up, select some text in an application and trigger the hot key (I’ve set it to control-option-command-q, but it can be anything you want as long as it doesn’t conflict with another function set to that shortcut).The macro will then:
• copy the text selection
• launch/activate DEVONthink
• open the text document specified in the macro
• date and time stamp the entry
• name the source application of the text
• paste the contents of the clipboard

Also, if the source application is DEVONagent or Safari, the URL containing the source of the text will be added. You can change this to add another browser, etc. to meet your needs, as long as command-L works to select the complete URL in the browser’s window.

I also use a Keyboard Maestro trick that I have discussed here before to combine macros with the same shortcut. I duplicate the macro, change the text file URL, name the macros beginning with the numbers 1-9, and assign them the same shortcut so that I can select to which text file the text will be appended. In this example, I select some text, type my shortcut to activate the macros, and will select ‘1’ or ‘2’ to send the text to a specific document.

Here’s what the first part of this post looks liked, clipped to a plain text document formatted with the Courier New font.

Download the Keyboard Maestro macro here.