**This is an old revision of the document!**
Scripting on OSX Using Keyboard Maestro
Set Keyboard Maestro variable using AppleScript.
# Keyboard Maestro — Set value of variable "<variable name>"
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
Get Keyboard Maestro variable using AppleScript.
# Keyboard Maestro — Get value of variable "<variable name>"
tell application "Keyboard Maestro Engine"
if variable "myKMVariableName" exists then
set myAppleScriptVariableName to value of variable "myKMVariableName"
end if
end tell