# Keyboard Maestro — Create variable "<variable name>" tell application "Keyboard Maestro Engine" make new variable with properties {name:"MyVariableName", value:MyVariableValue} end tell
Note – the variable name MUST be a string, although you can hold that string in a varible:
set someVariable to "MyVariableName" make new variable with properties {name:someVariable, value:MyVariableValue}
# Keyboard Maestro — Set value of variable "<variable name>" # Requires KM7.0.2 or higher. set myText to "whatever" tell application "Keyboard Maestro Engine" if variable "myKMVariableName" exists then set value of variable "myKMVariableName" to myText else make new variable with properties {name:"myKMVariableName", value:myText} end if end tell
# Keyboard Maestro — Get value of variable "<variable name>" # Requires KM7.0.2 or higher. tell application "Keyboard Maestro Engine" if variable "myKMVariableName" exists then set myAppleScriptVariableName to value of variable "myKMVariableName" end if end tell