%PromptButton% Is Always Empty

If I use %PromptButton% to get the name of the last selected "Prompt for User Input" button, this value is always empty, whereas the %ResultButton% does always contain the correct values.

Also in the menu "KeyboardMaestro >> Preferences >> Variables" %PromptButton% does not have any value. If I enter any value to %PromptButton% it keeps this value regardless of the name of any selected "Prompt for User Input" button.

Does anybody know what I can do to further investigate this error. I am using KeyboardMaestro version 10.0.1.

I using this simple example and the PromptButton did return correctly. I using v10.0.1.

image

thanks macdevign_mac for your test. This is my result:

You might want to check the KM Log file to see if PromptButton has been changed somehow (although it is unlikely but just to confirm)

Good idea thanks, I wasn't aware of the KM Log files. But they seem to be ok:
Last message repeated 8 times
2021-12-01 13:12:05 Execute macro “Test” from trigger Editor
2021-12-01 13:12:05 Log: Message

I could not see anything that is wrong in the script (aside that there is no trigger)

But let guess what is wrong first (I could be wrong)
Did you try running the whole script that is triggered by shortcut key , or did you just try only running each action by "Try Action". If you just running "Try Action" , I get the same result as yours. So have you try to set a shortcut key trigger and run them as a whole instead.

I just run the same test from a shortcut key trigger and got exactly the same result. Interesting that you got different results. I was not aware that running a macro e.g. for testing from "Try Action" can give different results than running from a key shortcut trigger.
But anyhow this gives unfortunately not a solution.

You cannot use %Variable%, you can only use %PrompButton% as it is token.

There is a difference between token and variable, only variable can be referenced by %Variable% , token cannot. Take away that %Variable% in %PromptButton%, you will see that it works.

:white_check_mark: Great, that gives the solution. Many thanks for your time, I learned a lot.

Np, when I first started using KM, I have the same problem identifying token and variable too.

By the way, the misleading point was the "Insert Token"-menu in the Action "Display Text". If I open my "Insert Token" menu, I have there an entry "PromptButton". If use it, it inserts "%Variable%PromptButton%. I am not sure, if that is only in my menu or if that may be a bug.

It is not a bug.

It means that you have created a global variable call PromptButton. So what is a token also become a global variable.

So what happens is that PromptButton which is a token, has also become global variable instead.

So it is better to ensure that a variable name is not name after a token.

The fact that you've used %Variable%PromptButton% previously means there is now a global variable called PromptButton just waiting there to further confuse you. Go into the Variables pane in KM prefs and delete that variable and then the only PromptButton you'll see is the real KM token.

Thanks @macdevign_mac and @tiffle.

Yes, I have deleted my PromptButton variable and now everything is fine.

Since the "Result Button" is not a token, but a variable, it was a little confusing. One should indeed depreciate using the "Result Button".