MACRO: Execute Macro by Name (Sub-Macro)

MACRO: Execute Macro by Name (Sub-Macro)

Notice! This Macro has Been Deprecated! Do Not Use.
Instead, use the latest version (1.2a+) at

MACRO: Execute Macro by Name (Spotlight)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

UPDATED: v1.1. Added support for passing a parameter, and fixed what might have been a bug, not sure, but it's fixed now anyway.

Execute Macro By Name Macros.v1.1.kmmacros (28.1 KB)

This allows you to execute a macro by the name of the macro. It's very simple to use.

The attached file has 3 macros in it, but two of them are to demo how to use the main macro.

Let's say we want to execute this macro:

All it does is set a variable called "Example Executed Macro Result" to "Hello World" and "%TriggerValue%" (which is a parameter we might pass to it.

Here's the code we use to call the above macro:

It sets the result variable to empty, so we know for sure we called the macro we intended to.

Then we execute our "Execute Macro By Name (Sub-Macro)" macro, passing the name of the actual macro to execute as a parameter. (To get the "With Parameter" box, click the "gear" icon and click "with parameter").

Then we display the result variable, to prove everything worked fine.

Here's the main macro:

Let me know what you think.

1 Like

Added version 1.1, above.

Thank you Dan this is a very helpful tutorial and example file, just what I needed.

1 Like