Variable which represents macro name

I can't find the variable which represents the name of a macro.
thanks in advance for your time and help

Try this:

Yes, exactly as shown.

1 Like

works perfectly, thank you very much.
In a previous post we discussed variable syntax. I thought I understood and all of a sudden, I am puzzled by the syntax of this variable.
%ExecutingInstanceName%%
why % twice at the end ?
As @Zabobon taught me, I wanted to change the name to Variable%ExecutingInstanceName%% , but the correct syntax turns out to be %%Variable%ExecutingInstanceName%%
thanks again

I thought that could confuse you. You see, it's like this token: %Calculate%1% which requires a parameter, and the ExecutingInstanceName token also requires one... but it's "optional". Yes that's weird, but that's the way it is.

2 Likes

Great. Crystal Clear. thank you !

@Sleepy has explained why you need the double %% at the end.

Also - this is not a Variable. It is a Token.

Variables are created by you. Tokens are built into Keyboard Maestro. This has caused endless confusion to everyone including me in the past as they look similar with the enclosing %

One reason it is good practice to quote Variables with %Variable% at their front is it tells Keyboard Maestro they are definitely Variables and not Tokens

There is nothing to stop you naming one of your own Variables the same name as a built in Token.

For example there is a Keyboard Maestro Token, %LastApplication%

This returns the name of the last application.

But you could also make your own Variable and call it LastApplication.

By quoting your Variable as %Variable%LastApplication% rather than just %LastApplication% it achieves two things. It tells Keyboard Maestro to treat this as your Variable rather than its own Token and it shows you at a glance when editing the Macro that this is a Variable and not a Token.

I know… confusing and hard to get at first. But we’ve all been there and then it suddenly becomes clear :sweat_smile:

3 Likes

I greatly appreciate your excellent explanations.
I had read about variables vs tokens, but did not realize I was dealing with a token.
With each of your explanations, I am taking on new habits which is great.
If it continues, I will have to put a statue of you in my living room

1 Like

Don’t forget to have a statue of @Sleepy too :rofl:

1 Like

@Sleepy yes definitely !

When you search for "seven dwarfs" on Amazon, these things pop up at the top:

Screen Shot 2022-03-10 at 12.02.56 PM

Screen Shot 2022-03-10 at 12.03.28 PM

1 Like

how I understand your name.