set myKMVar to my getKMVar("MY_KM_Variable") on getKMVar(pKMVarNameStr) --- Compatible with Keyboard Maestro 6+ --- -- • Returns "" if variable is not found (just like KM 7 getvariable) tell application "Keyboard Maestro Engine" try set kmVar to value of variable pKMVarNameStr on error errMsg number errNum if (errNum = -1728) then --- KM Variable NOT Found --- set kmVar to "" else error errMsg end if -- END on error end try end tell return kmVar end getKMVar