Keyboard Maestro 5
Conduct your Mac Like a Pro!
Keyboard Maestro includes permanently stored variables that you can use in a number of special purpose actions, as well as in Calculations or Text Tokens which can be used in almost any field in Keyboard Maestro.
Variable names must start with a letter, and then can contain letters, numbers, spaces, or underscores. Variable names are case insensitive, but their case is remembered.
Variable names that starts or ends with “Password” or “PW” are considered passwords - there values will not be stored (except in memory) and they cannot be read by shell or AppleScripts. The Prompt For User Input dialog will display such variables in a password field.
Variable values are text, but they can contain comma separated numbers, and can then be accessed as arrays (eg Variable Name[1]). Mouse positions, window frames and the like can then be stored and manipulated in variables.
Variables can also be accessed from shell scripts via the environment variables in the form $KMVAR_Variable_Name where KMVAR_ is prefixed, and spaces are converted to underscores.
AppleScript can read variables with:
tell application "Keyboard Maestro Engine" set myVar to make variable with properties {name:"Calculation Result"} set theValue to value of myVar end tell
and write variables with:
tell application "Keyboard Maestro Engine" make variable with properties {name:"My Variable", value:"New Value"} end tell
and delete variables with:
tell application "Keyboard Maestro Engine" try set myVar to make variable with properties {name:"Old Variable"} delete myVar end try end tell
You can also set a variable value to %Delete% to avoid having it show up in variable popup menus.