I had a big aha moment as I watched this video today at 29:45.
I have often lamented that both variables and tokens are surrounded by % signs. It seemed difficult to tell them apart when reading people's macros and I guess it still is since I don't know all the tokens versus what somebody chooses to name a global variable.
"Variables are a special type of token that take one parameter."
So if I understand correctly behind the scenes, Peter just made it so if it's not recognized as a token, then it's assumed it's a variable token and she used to be smart and just run without the token value of variable. I'm sure that's for convenience and speed, though it has very much blurred the lines for me between, again, knowing the difference between if something is a token or a variable at a glance.
Of course, reading through the script, you'll see variables get set, and most of the people who post frequently always include %Variable%MyVarName% rather than just %MyVarName%, though both work to make it easy to know if it is a token or a global variable.
If anyone has any tips or tricks they have to know at a glance when someone doesn't include the %Variable% "token" in the name besides having all the tokens memorized, I'd love to know and hear your insights.
You can also use a short form of just %Variable Name% to include variables as long as the variable exists and has a value and there is no corresponding text token, although generally it is better and clearer to use the longer form %Variable%Variable Name%.
It might be said that
"The %Variable% token is a special type of token that takes one parameter"
...but that would be to ignore all the other tokens that can take a parameter! Suddenly, not so special...
So absolutely lost on this one and what you are showing. I know it is clear in your mind. You of course can't set Local_i + 1 unless you have assigned Local_i to a number previously. There also wouldn't be a percentage in use because it is not required or allowed in the Set variable action.
I am just not seeing what you are explaining and how that makes Variables not a token. My hope that I was going to have some resolution why Peter didn't just use some other symbol to indicate a token like surrounding it and + signs or something else to easily differentiate them.
You have a variable: Local_i. That is the name of the variable.
You have the text token %Variable%. That takes a parameter -- the name of the variable of which you want to get the value of. In this case the variable Local_i. So %Variable%Local_i%.
Variables aren't text tokens. %Variable%is a text token. Peter didn't -- shouldn't -- choose another symbol because it isn't a different thing. It's a text token and should be indicated as such by %s.
The fly in the ointment is the "short form" text token -- %Local_i%. Because it can't be resolved to an actual text token the Engine assumes a missing %Variable% and tries to resolve %Variable%Local_i%.
I don't know if the "short form" is the original form and is only kept for backward compatibility. But I seem to remember (citation needed!) Peter saying that he wished it had never existed!
Always use the explicit %Variable% form in your own macros, for your own sanity if nothing else. And hope that if we all do that for every macro posted here then the "short form" version will fall out of use, to the benefit of all.
I'm disinclined from providing support to people who use the short form. So another good reason to use the long form is to be able to get more tech support on this website.
I never thought of it as all of those things. I really wish I had gone through programming school.
Thank you for the information and help on this one guys. I will continue to digest and work through but it is starting to make sense though I look through a glass darkly. I got loud and clear and am grateful that not using %Variable% in front of Global Variables is not cool and welcome.
Okay, though I try to always use %Variable% I will be even more inclined.
Thanks all for your help on this one. My also take away is it is difficult for everyone here to spot a Global Variable (I'm a little scared to ask that question because I likely missed a point somewhere and put it on top of my head instead).
You know all this -- you use it every day in every macro. Don't overthink it!
Not necessarily...
The whole point is to make it obvious to yourself, to the Engine, and (if posting here) to others what your intention is. Using %Variable%varName% does that.
But so does %Global_varName%, %Password_varName%, %Local_varName%... If you've included an explicit variable scope it's obviously a variable! I'd argue that it's better -- more informative -- to include scope at the expense of an explicit %Variable%.