About Resetting Variables

Sure. Variables, and where they are listed, is extremely complex. And so is AppleScript.

In Keyboard Maestro, if you set a variable to the empty string, then the variable is removed and no longer exists.

If you set it to “%Delete%” then the variable exists, but its display in variable lists is suppressed, and its value is functionally empty.

The listing of all variables is all the variables with values, plus all the variables that are referenced directly in any action (not as tokens), minus all the variables whose values are "%Delete%".

More or less.

Largely, people should simply stop concerning themselves about deleting variables, unless a variable is large (eg holding contents of a file). And they should use Local or Instance variables as appropriate.

Setting variables to %Delete% is simply a hack to have them not displayed in the variable lists (Preferences, popup menus, etc). It's not generally a good idea.

4 Likes