[KM] Sub-Macro to Set Variable Passed as Parameter [Example]

###MACRO:   [KM] Sub-Macro to Set Variable Passed as Parameter [Example]

~~~ VER: 1.0    2016-08-28 ~~~

####DOWNLOAD:
[KM] Sub-Macro to Set Variable Passed as Parameter [Example].kmmacros (3.2 KB)


###ReleaseNotes

Author.@JMichaelTX

PURPOSE: Show How a Sub-Macro Can Set a Variable whose name is passed as a Parameter.

HOW TO USE:

  1. In Your Main Macro, enter the name (not the Token) of the Variable in the Parameter Block of an Execute Macro Action
  2. In the Sub-Macro, enter "%TriggerValue%" as the Variable name in a Set Variable Action

WHAT IT DOES:

  1. When the Sub-Macro is executed, it translates the %TriggerValue% into its value, which is the name of the Variable.
  2. The Set Variable Action then executes normally, as if you had directly entered the Variable name into it.

TAGS: @SubMacro, @TriggerValue, @HowTo, @Example, @Variables

REQUIRES:
(1) Keyboard Maestro Ver 7.2+
(2) Yosemite (10.10.5)+


---

<img src="/uploads/default/original/2X/6/6a095f22341995d43c56d0d3e0ee56d67de344e5.png" width="568" height="434">

---

###Example of Main Macro Calling This Sub-Macro

[KM] Set Variable by Sub-Macro Passed as Parameter [Example]

<a class="attachment" href="/uploads/default/original/2X/4/4fa0465ed59d360b11bdcf7e49c9adcdea7e7190.kmmacros">[KM] Set Variable by Sub-Macro Passed as Parameter [Example].kmmacros</a> (3.1 KB)

<img src="/uploads/default/original/2X/b/b678c317dc22e88ee0aed4a9be54a114f1e34d9f.png" width="568" height="619">
1 Like