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:

Add PS to Keyword metadata of RTF

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:

Change to Arial 14pt and add Note

To paste the name of a file into the content of the RTF:

Copy Name to Content of RTF

To create a new RTF document and add a keyword:

Create new RTF note with KW and title in content

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.

Open up PDF in Acrobat to delete etc

There are, however, some important caveats for macros:

  1. 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).
  2. 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.
  3. 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.
  4. 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.

Enjoy.

Advertisements

Tags:

2 responses to “Keyboard Maestro + Devonthink”

  1. Dellu says :

    Thank you. I think I will use the last one. Do you know that u can export the macros and attached them for your readers in here (or a link to dropbox)?
    that will make it faster for, may be hundreds of us, to use your macros.
    (sorry for my selfish request 🙂

    cheers

    • jostwald says :

      It doesn’t look like the ‘code’ behind the macro is visible to users (at least that I can find), but there is a way to export a macro, which I could do. Those interested can send me an email (ostwaldj at easternct dot edu) and I can email attach them – I just exported one and it weighed in at a whopping 6 kilobytes. Of course if hundreds of people respond, I’ll have to rescind that offer! I’ve got things to do.
      I would recommend that anyone interested at least try to create a macro for themselves – there are all sorts of possible tweaks one might want to make, and it’s a good idea to be able to customize macros. Improvements welcomed.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: