Last active
December 3, 2024 10:19
-
-
Save JMichaelTX/25ad8069b513bea77444 to your computer and use it in GitHub Desktop.
Set Keyboard Maestro (KM) Variable using AppleScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###—————————————————————————————————————————————— | |
# setKMVar() Sets KM Variable, Makes if needed | |
# | |
# Ver 2.0 2015-12-27 | |
###—————————————————————————————————————————————— | |
on setKMVar(pKMVarName, pKMVarValue) | |
--log ("setKMVar: " & pKMVarName & ": " & pKMVarValue) | |
tell application "Keyboard Maestro Engine" | |
try -- to set variable, will error if it doesn't exist | |
set value of variable pKMVarName to pKMVarValue | |
on error -- Make & Set Variable | |
make new variable with properties {name:pKMVarName, value:pKMVarValue} | |
end try | |
end tell -- KM | |
end setKMVar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment