The Robservatory

Robservations on everything…

 

Updated: Find Keyboard Maestro macros by shortcut

Note: Revised on December 4, 2018 with a much better implementation of the pop-up palette, and some changes in timing and mouse movement.

One of the “problems” with Keyboard Maestro is that it’s so useful I use it a lot, leading to a large collection of macros. Due to the number of macros, sometimes when I want to add a new shortcut, I can’t remember if I’ve used that shortcut before or not. Today’s tip comes in two flavors to address that problem: Simple and Complex.

The Simple solution

Short of just trying the shortcut, there’s a way to check from within Keyboard Maestro itself: Type the macro’s activation keys into the search box, as seen in the box at right.

You can’t do this by pressing the actual shortcut keys—you have to type their character representations. You can do this with the “Show Emoji & Symbols” option under the flag icon in the menu bar, if you’ve enabled it in the Keyboard System Preferences panel. But finding those few special keys (if you even know how to search for them) is a pain.

Technically, you could also use the pop-up character palette macro I wrote, except there’s an issue: When the palette activates, it deactivates the search box, so the characters don’t make it there. It’s also overkill for this task, because there are characters that wouldn’t be part of keyboard shortcuts, and you’d never need the HTML codes, just the characters.

So I wrote what wound up being a set of new macros that make searching for assigned keyboard shortcuts much easier.

The Complex solution

I wanted a really-easy way to search assigned shortcuts, one that wouldn’t require opening the Keyboard/Emoji viewer, and was only active within Keyboard Maestro. After some tinkering, I wound up with two new macro groups, a new character palette macro, and a new macro to display the new character palette. Huh?

Basically, those things all work together to pop-up an easy-to-use palette when I’m searching, as seen in the image at right. This palette doesn’t pop up automatically; I have it paired to a “search for keyboard shortcuts” hot key—that way, I can use both it and normal (⌘F) search modes.

You can, as usual, download the macros to edit/use as you wish. This archive contains all of the groups and macros discussed below.

Step one: Create a Keyboard Maestro app macro group

This group contains macros that are only available within the Keyboard Maestro app, that is, when you have the Keyboard Maestro editor window open. The group setup is really simple, just set the “Available in these applications” pop-up to show Keyboard Maestro:

I named this group _KM, and it’s only going to hold one macro (unless/until I have more macros that only run when Keyboard Maestro is active).

Step two: Create a new macro in the new macro group

This macro will be the one you trigger to search for your keyboard shortcuts, so assign it an easy keyboard shortcut, and give it a fitting name. Because this is a Find shortcut, I assigned it to ⌘⌃F and named it Find by Special Char. (In the original version of this post, I had assigned it to ⌘⌥F, but Keyboard Maestro now uses that for “Find in All Macros”). Here’s how this macro looks:

The macro waits a split second (because I found it sometimes failed if I didn’t do this), then sends a ⌘⌥F to activate the search box—searching the All Macros level. (If you want to only search whatever sub-group you’ve chosen, change that to ⌘F).

It then moves the cursor to a spot down and left of the top-right corner of the window, activates another macro group, pauses again, and then moves the cursor once more. So what’s all that about?

The first mouse move is to a fixed location near the find box because a pop-up palette of keys will soon appear in that location…that’s what the activated macro group does—it activates a palette under the mouse. Once the palette is onscreen, another quick pause, then the mouse is moved to the ‘x’ box of the pop-up palette, for easy dismissal.

If you’re writing these on your own, you won’t have the macro group yet, so just insert the step but leave it set to “none” until you have the next bit done.

Step three: Create another new macro group

This second macro group is set up to activate only in certain situations:

As you can see, the macros in this group will only run within Keyboard Maestro, and only when the editing window is frontmost. No activation keys are defined, because the palette will only be visible when called by the first macro.

So what’s on the palette? These four macros…

These are simply the four keys that I use as modifier keys in my shortcuts—it’d be easy to add more, if I used the arrow keys, too, for instance. Each is a very simple two-step macro with a single-key activation key and the special character. Here’s the macro for the ⌘ key, for example:

These can be triggered by single key shortcuts because they’re only active when the macro group is active, and that’s only true if I’ve activated the ‘search for keyboard shortcuts’ macro. And that’s pretty much all there is to searching for my macros with a macro and a pop-up palette. (You have to manually close the palette when done; I haven’t found a way to make it auto-dismiss—but with the mouse over the close icon, that’s easy to do.)

Note: Search in Keyboard Maestro wil find all references to the keyboard shortcuts—not just those defined as keyboard shortcuts. This is why you’ll probably see non-matching results when you search on special characters. But if you click into one of the apparently non-matching results, you’ll find the hot key combo somewhere in there.

4 Comments

Add a Comment
  1. Ah, I missed that tidbit. I either close the palette, or because I defined the keys as lowercase, I can type uppercase versions with the palette still onscreen.

    -rob.

  2. While I can show a palette with ^F, the palette doesn’t show when running the search macro (cmd-opt-F). I first made the macros on my own and then I downloaded your macros.

    I am running KBM 8.2.4 and MacOS 10.14.1. Any ideas why the control-F shortcut in the search macro won’t get the palette to show?

    1. Norm:

      Thanks for making me take another look at this. Things have changed since I first wrote it, so I’ve updated it with a much better activation method (activating the macro group instead of triggering the keyboard shortcut), and changed how some other bits work. It should work fine now; I updated and tested in Mojave, but it also works in High Sierra.

      -rob.

Leave a Reply

The Robservatory © 2018 • Privacy Policy Built from the Frontier theme