Keyboard Maestro Macro for Naming and Tagging Documents

I use a standard format for naming most documents in DEVONthink

.

To speed this along, I have a Keyboard Maestro macro that prompts for all these fields, and also tags for the document, and then renames it and adds (replaces) the document’s tags. The only required field is “Name” – if any of the other default values are left in place, then the rename macro will ignore that field.

Note: tags are replaced. I only use this for new documents - so I didn’t bother to collect and retain any previous tags. But you could do that by changing the embedded AppleScript.

To use it, install in Keyboard Maestro. In DEVONthink, click into the file name (so that it is highlighted and editable). Press the KM trigger (I use “…fn” - you can use whatever you wish. File in the form. Press OK or Cancel.

You can edit the macro to add / change / reorder the fields to your taste.

The macro can be found here.

Nice macro korm, very nice. I’ve been using a TextExpander macro to name files that has fields and document types as a list, but I believe that I will switch to your implementation as I really prefer to do everything in Keyboard Maestro when possible. It’s not that I don’t like TextExpander-I do, I just like to use TextExpander Mac as the editor to create macros for iOS.

For the savvy user, it’s possible to do a lot of customization to korm’s macro without a lot of trouble. As example, I usually date documents with the current date, in the format ‘2012-12-12’. The following change to korm’s macro will add the current date by default if nothing is changed in the date field, otherwise the user can enter a different date, or delete from the entry form to have no date entered.

As another option for customization, I have posted here in the past on assigning the same shortcut to multiple macros to get a Keyboard Maestro pane to select the desired macro. Here is the one I use in DEVONthink to create a new document, called with command-n.

As example, you could use this approach with korm’s macro if you use a document type naming convention similar to Merlin Mann’s ‘refx’, ‘ideax’, ‘runx’, etc. Just duplicate the macro for each of the document types that you use, and modify each of them so that when the macro is selected it will default to a specific document type.

Greg’s additions and suggestions are fine and welcome. Thanks!

I originally wrote this in TextExpander, and still have a TE version. Without the tagging piece, it is much easier to do this sort of thing in TE. However, KM excels at incorporating automation such as the portion of the macro that uses AppleScript to set tags on the document.

For those who would like a TE version, here’s a snippet that works over here, but doesn’t have tagging and doesn’t have the context-sensitive edits for optional items that the KM macro provides:


%fillpopup:name=TYPE:default=Document:Graphic:Correspondence:Artifact:Annotation:Reference:Research%_%filltext:name=Who What (detail):width=30%_%filltext:name=yyyymmdd%.%filltext:name=version%.%filltext:name=ext:width=10%

To use this with TextExpander:

  1. Create a snippet with “Plain Text” content
  2. Copy and paste the above code into “Content”
  3. Modify the “Type” default list for that popup, if desired
  4. Assign a Label and a TE abbreviation