Trigger Keyboard Maestro Palettes With A String

January 15, 2013

Trigger Keyboard Maestro Palettes With A String → via @_patrickwelker

I’m a big fan of text expansion. In the meantime a major part of my TextExpander snippets live in Keyboard Maestro. Here are my two main reasons why this is the case:

  1. Kaushik Gopal’s was the main reason why I finally started using Keyboard Maestro as a serious replacement for TextExpander. His article about using 2x SPACE as a suffix for string triggers initiated the spark and finally I could dismiss prefixes like , . - – I always had trouble remembering those.
  2. Keyboard Maestro brings the advantage of palettes to the table. This means I don’t have to remember countless hot key combinations, but get the chance to build sets of logically related groups

Why palettes and why text string triggers?

As I started building up my macro palettes for text expansion I noticed that I quickly ended up with more and more palettes. This also meant more hot keys to remember. I continued creating palettes until I reached a point where I simply failed to retain the dozen shortcuts I assigned and which I needed to call them up.

It is a fact that one already saves a lot of brain real estate for remembering hot keys since all there is to do is type one shortcut to bring up a palette which then again tells the user which letters or numbers he assigned to the actions that he put in the palette in question (e.g. M. Open Apple Mail).

What bugged me was that I couldn’t use string triggers for calling up a palette. When I want to expand text snippets it is certain that I’m inside of an text editor and that I’m in writing mode. Hot keys are fast, but they throw me off track and interrupt my flow – last but not least because I have to come up with the correct hot key. Most times a logically related group would be more ideal for keeping me focused. For instance fruit SPACE SPACE could open a palette like:

  • apple
  • banana
  • cherry
  • dragon fruit
  • elderberry
  • fig

This is more reasonable for me to grasp and my mental lexicon has no troubles recalling this information.

For those of you who prefer to see this in action I put together a short 18 second screencast:

How to do this?

  1. Create a normal Keyboard Maestro group – mine is called “Hot Triggers: Strings for Palettes”. All palettes you would like to summon with a string should go in this group. km-hot-triggers
  2. Copy the macro from the screen shot above. This macro is trigger via a string – here emoticon SPACE SPACE.
  3. All that is left to do is adding an AppleScript which simulates pressing the hot key combination – choose a complicated one which doesn’t get triggered by accident. I choose: cmd+opt+shift+ctrl+6.
  4. Now start building your palette like this: km-emoticons
  5. Lastly, create your text expansion macros: km-te

Side note

If you want to take the shortcut and export your TextExpander snippets as Keyboard Maestro macros then visit Nik’s Crappy Blog for an AppleScript which does just that – it literally saved me a ton of work.

Disclaimer

Keyboard Maestro doesn’t support this feature officially. This hack isn’t intended and that’s why Peter Lewis, the developer behind Keyboard Maestro has given me these words of wisdom – it’s a warning a you should read it too:

I don’t think I’d support string triggers for palettes, for the same reason that multiple matching string triggers that generate a conflict palette disable the deletes. The reason is that the deletes are potentially wildly dangerous (eg, imagine if they appeared when you have mail messages or files selected).

So typed string triggers with deletes are only used if I can be reasonably sure you’re still where you typed the string (and I rely on you to be sure you only type it in a typing context).

I used Hot String Triggers for palettes for quite some time now – so far nothing went pear shaped, but this must not mean your text is save if you are a fast app switcher or trigger too many stuff at once.

comments powered by Disqus

Related Posts