Keyboard Maestro + Devonthink
A reader request prompts me to post screenshots of some of the Keyboard Maestro macros I’ve developed to speed up data entry. See my previous post and comments for a description of the various macros.
I’ll assume those interested know the basics of how KM works: click the + button at the bottom of the Macros (middle) pane and name the macro. Choose New Trigger-Hot Key trigger and type a unique key combo to trigger the macro, then choose New Action to add Actions from the middle pane to the right pane. A lot of it simply requires figuring out what combination of key commands will allow you to select various bits of text and navigate within the various panes. On with the show:
To add a value to the Keyword metadata field of a record:
To change the font style of a RTF and add a keyword, once you’ve defined a custom font style in DT and assigned it a keystroke in OS Settings and have the ruler shown in the DT document window, you can do this:
To paste the name of a file into the content of the RTF:
To create a new RTF document and add a keyword:
You can also open a PDF document in Adobe Acrobat so that you can delete pages and add file metadata without bloating the PDF file size (which is what happens if you do it with DT’s PDF engine). This one isn’t perfect, it sometimes requires two attempts to work, but I’m too busy to debug it right now.
There are, however, some important caveats for macros:
- KM needs to be running for the macros to work, so you will need to open KM when you restart your computer (or open it automatically on startup).
- You need to be very specific about always starting at exactly the same spot when you run a macro, since all a macro does is blindly invoke menu/key commands and mouse clicks. They are extremely sensitive to initial conditions. For example, most of the above macros require that you have a specific record selected, i.e. the “focus” must be on a specific highlighted record in the middle list pane. If you try to run these macros with, for example, your cursor insertion point inside a record’s content (right-most pane), it WON’T work and may try to do other things. In this sense a macro is dumb, compared to code.
- Macros have a hard time doing contextual menus (i.e. right-click pop-up menus), since the exact location (X,Y coordinates) of the mouse cursor dictates which options are available on the pop-up menu. There are ways to position a cursor precisely in KM, but I assume that would require your various windows to be consistently located in the same place every time. Hopefully any contextual command is also available as a regular menu item, or a key shortcut.
- The above macros only work on a single record. I’m still figuring out how to combine the For Each loop function in KM with DT.
Applescript is in many respects more powerful and much faster – you can Google macro vs. Applescript for online discussion, and the DT fora are full of scripts. But I’m limited to the code my wife can cobble together from existing scripts, though she is pretty good at it considering it’s not her native language. You can also combine Applescript with KM as needed.