Hey JM,
This is actually new and improved in KM 7.0.2. (REQUIRES Keyboard Maestro 7.0.2)
####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
---------------------------------------------------------------------
-Chris