Got two questions about Keyboard Maestro variables:
- On the Wiki it says variables can be Global, Instance and Local.
I am struggling to understand: When would an Instance or Local variable be useful over a global variable? I’ve read the wiki several times but I can’t wrap my head around the usefulness of Instance/Local variables over just using global variables all the time. Do global variables have a disadvantage that Instance/Local variables solve? It would be nice if there was a pro/cons list for each type to better understand them.
- In the Variable Dot Notation section it says that the calculation field allows you to use dot notation.
Example “Variable.x” to get the X coordinate of a variable. Or "Variable.width" to get the width of a rectangle or size.
I don’t understand where would these values come from. For example, if I created a variable called “Shape” and set it to a value of 10, where would the width value come from?
Would I have to specifically set a value of Shape.width = 10 earlier in the macro? I’m sure I would. But it says that Dot Notation is used in the calculation field. So does that mean earlier in the macro, I’d have to create a calculation field that says Shape.width = 10. And then put a separate calculation field later on to access the “Shape.width” value? Is that right? Or can I set "Shape.width" outside of a calculation field?
Sorry if these questions seem a little basic. I am trying to better learn variables to make better usage of them. I did search around but am still stuck on these two areas. Thanks in advance for help!