Insert 'Execute a Macro' by Name

I'm hoping to save a few keypresses when inserting many "Execute a Macro" actions.

  1. Insert Action by Name…
  2. "Execute a Macro"
  3. Click None
  4. Click 'Macro by Name'
  5. Type Macro name
  6. Hit Return

Which I'd like to be

  1. Search for macro
  2. Type name
  3. Hit return to insert "Execute a Macro by Name" action

I can think of four ways to do this

  1. Turn every 'Execute a Macro' into a favourite action
  2. Search macros through a prompt with list that returns the UUID, and inserts the action XML
  3. Doing it with Keyboard Maestro menu commands like this
    Select “By Name…”
    Select “Copy as Execute a Macro Action”
    Select “Previous Edited”
  4. Automate the Keyboard Maestro editor to go straight to the 'Macro by Name' search

I also know you can hold ALT + SHIFT to copy a macro as an 'Execute a Macro' action, but they're not always on hand to drag

I was wondering if anyone has made anything like this? I think 2 is cleanest…

That was my first thought too -- except it adds the action with the options hidden:

image

...unless you set both the Asynchronously and UseParameter keys to true:

image

Either way you're into some extra clicking to enable or disable those options as required.

Perhaps the simplest way is macro the Editor itself, so it behaves just as you are used to and gives the results you expect. The following took less time to write than this post did! It can easily be improved/customised, but it does the job:

Insert Execute by Name.kmmacros (83.9 KB)

Image

1 Like

Thanks for this. It works! (Except in dark mode!)

I don't actually mind it appearing without the parameter box for some of the uses I have in mind.

While I was testing this I found a macro by @DanThomas which I tweaked to do what you've also done

Insert "Execute Macro by Name" v0.1.kmmacros (22.1 KB)

2 Likes

Yep -- anything that involves found images will likely need tweaking for your own situation.

It's not immediately obvious, but you can include both light- and dark-mode image conditions and use "any of the following..." if you like to switch between modes.

It's the "some" that's the problem. Of course, it's easy enough to to set two triggers then change the XML based on %TriggerValue%, perhaps setting Asynchronously and UseParameter keys to true if the trigger includes the ⌥ key.

1 Like

That's a good idea… I've added that, and also included your action for stripping the 00) prefix off names

Insert "Execute Macro by Name" v0.2.kmmacros (25.6 KB)

1 Like