Try Macro *or* Action

Inspired by @DanThomas’ question “Is there a key to ‘try’ the current macro?”.

While editing a macro I frequently click the Try button (or ⇧⌘T) to test the macro.

What then happens, very often, is that the KM Editor runs an action instead of the whole macro. Of course, this happens because I still had the last edited action selected.

This happens especially when I had selected a nested action and then scrolled out of view and hit ⇧⌘T.

To my knowledge — in this case the only way to try-run the macro (instead of a selected action) is to…

  1. select any top-level action (clicking, or repeatedly ⌃⌘← ‘Parent Action’) and then…
  2. hit either ⌘A or ⌥⌘A (Select all or Deselect All) and then…
  3. hit ⇧⌘T to try-run the macro.

(When the selected action is a nested action ⌘A or ⌥⌘A alone will not work, because the reference system for ‘(De)Select All’ seems to be the nesting level/group.)

This macro does the three steps above with a single key stroke (for example F1).

For running only the currently selected action (not the macro) you can do so by long-pressing F1. (‘Parent Action’ and ‘Deselect All’ will be bypassed.)

(You may want to experiment with the Pause value. On my machine the macro is slow enough to make an explicit pause unnecessary.)

You can also invert the condition to F1 is down so that a short press runs the selected action and a long press runs the macro.

If you are used to the built-in key ⇧⌘T you can use it as trigger instead of F1. Just change the key in the condition too.

Note: The macro will not be able to run a macro if an action is selected and KM’s window focus is in the ‘Macros’ list column. But the Try button (or ⇧⌘T) won’t do either. I haven’t found a way to shift the focus back to the editing view. (May be possible with AppleScript.)
→ See update in post below ↓

Update (2016-07-08): See post below ↓

1 Like

New, streamlined version:

Try Macro or Action [Ver 1.0].kmmacros (35.3 KB)

@DanThomas inspired me once again. Indeed, one short AppleScript is better (and faster) than a bunch of clumsy UI menu actions and menu state checks :wink:

Functionality is the same as before:

  • short key press → try macro
  • long key press → try selected action(s)

Plus two benefits:

  • When the window focus is in the ‘Macros’ list and an action is still selected, the short key press will now correctly run the whole macro.
  • You can also run a macro that is selected in the ‘Macros’ list and not opened for editing.

For the general description see first post.


Hey Tom,

Heck – I should have thought of that…

Well done!


Small change required for use with KM8:

(One of my favorite macros! Thanks @Tom!)

1 Like

Thanks for the note, Christian. I will update it later.

But with KM 8 the macro is (almost) redundant. (Now the editor has a Run Macro function, in addition to the Try Action.)

Oh I See that now! My Run Macro menu item is always grayed out though… what am I missing?

1 Like

Same here, menu item gray. I’ve noted this only now. (I had always clicked the KM8 Run button at the top of the window until now.)

Can’t find a way to make the Run Macro menu item active.

OK, this version should work again:

Update for KM8 (ver 1.1)

Try Macro or Action [Ver 1.1 for KM8].kmmacros (36.2 KB)

Paging @peternlewis, how do we un-gray this menu item? Thanks!

Sorry, yes, the menu item is always disabled. Ooops.

Fixed for 8.0.1.


So in 8.0.1, something like this is what I'd be using:

Have you seen the update I posted above. It works with KM8.

Of course, you can always run a macro by GUI-scripting the Run Macro menu item, but IMO the non-GUI-scripting way is always better. And the AppleScript in my macro still works.


Fixed in Keyboard Maestro 8.0.1 update.

1 Like


I noticed that the Try Action does not work when there are multiple actions selected because the Menu Item name is dynamic based on the number of actions selected.

Is there a way to fix this to include multiple selected actions as well?


1 Like

Hey Chris,

That's easy to fix.

Wiki ⇢ Select or Show a Menu Item Action

“Alternatively, you can start the name with an ^ and use a regular expression to match the menu.”


Try Actions v1.00.kmmacros (6.0 KB)


Keyboard Maestro Export


Hi Chris,

Thank you so much for teaching me something new. KM supports regular expressions for matching menu items. It amazes me what KM can do every time I learn something new. It is so versatile. Really appreciated the help. :slight_smile: