How can I provide a running Macro's Name and UUID to separate Local Variables and use them as Local Parameter Variable for an "Execute a Macro" Action in KM 10?

Hey Folks

Since KM10 I have to rework many Macros caused to something that has changed.

When I was using KM 9.2 and used the Token %ExecutingThisMacro% in a Main Macro - I got only the Macro Name.
The same but only asking for the UUID using the Token %ExecutingThisMacroUUID% - I got only the UUID of the Macro.

For my Setup I then used:

  • Var "Local__MacroUUID" => "%ExecutingThisMacroUUID%"
  • Var "Local__MacroName" => "%ExecutingThisMacro%"
  • Var "Local__MacroParams" in Execute a Macro with Parameter => "%Variable%Local__MacroUUID% & %Variable%Local__MacroName%"

This way I had the ability to set the Sub-Macro up as:

  • Var "Local__TriggerMacroUUID" => "%TriggerValue[1]%"
  • Var "Local__TriggerMacroName" => "%TriggerValue[2]%"

I then used these Infos to switch the routines in the Sub-Macro based on the Main Macro.

Now when I use this kind of approach I get both - the Name and the UUID when using the Token %ExecutingThisMacroUUID% .

What can I do to get the old functionality of my Macros back without using the new Subroutine-Feature ??

Hi Tobias (@Nr.5-need_input ) - I just tested this on my KM 10 and it works with no problem.

I think it would be helpful if you posted up examples of simple macros that exhibit this odd behaviour and I'll do some more testing!

Oh - by the way, to enable using the trigger value as a KM array you can't do this:

You have to do this instead:
%Variable%Local__MacroUUID%,%Variable%Local__MacroName%

Notice the comma and not an ampersand.

1 Like

Thank you for your reply Taj ( @tiffle ),

I don't use a comma and even not an ampersand.

I set the Variable up as this:

Bildschirmfoto 2022-01-20 um 15.04.45

I'll come up with an example later this day on how I set my Macros Up....

Greetings from Germany

Tobias

well, you did in your original post!

In order for %TriggerValue[1]% and %TriggerValue[2]% to work properly you need to make %TriggerValue% into a KM array, which you must do by separating the two values with a comma like this:

%Variable%Local__MacroUUID%,%Variable%Local__MacroName%

which is therefore what you must have in your action that sets up the value of Local__MacroParams

No that was an description of what I do.

here is a simple setup template for my Description in the OP.

ForumTestMacros.kmmacros (10,1 KB)

This Macro Group contains two Macros awailable only in KM:
A Main- and a Sub-Macro

Tobias - the file you provided contains only one macro, 01)Main-Macro

fixed the File attachment. It should now contain two macros

OK Tobias,

First error:
KM 0 2022-01-20_15-12-46

You have only one underscore in the variable name - it should be two.

Second error (and this is what I pointed out in post number 4 above):

You need to create a KM array using a comma as separator, not a newline as I've shown.

When you remove these errors your test macro gives this output:
KM 2 2022-01-20_15-14-28

If you want to use KM arrays and you're unsure about them, have a look at the KM wiki here (about halfway down the page): manual:Variables [Keyboard Maestro Wiki]

Thank you Taj

You've nailed it - even with my "underscore mistake".
I don't now how I didn't see that.... :joy::joy::joy:

I am thinking about a Macro now to avoid such mistakes in the future... :sunglasses:

Greetings from Germany

Tobias

1 Like

We’ve all made that mistake my friend!