Your inquiry is not for naught as it still applies to the KMINFO_ prefixed variables.
As far as I know, they are only way to get the macro/group environment info directly into the script and, like KMINSTANCE, are always available so you don't have to choose them in the environment variables chooser.
The AppleScript bug making "system attribute" not safe for international characters is a gotcha
in particular with KMINFO_Trigger and KMINFO_TriggerValue and KMINFO_ vars that get names of executing macro and group.
If you don't need the hotkey modifier glyphs, and, for example, just want to know if "long press" is contained in the KMINFO_Trigger, use:
set isLongPress to ((system attribute "KMINFO_Trigger" as text) contains "long press") as boolean
otherwise use:
set triggerDescription to do shell script "echo $KMINFO_Trigger"
That will get you the modifier glyphs correctly rendered or any parameter passed via KMINFO_TriggerValue that might contain international characters.
The following is safe here because ASCII characters are returned:
system attribute "KMINFO_MacroUUID"
system attribute "KMINFO_ThisMacroUUID"
If names of the macro or group contain international characters you'll want to go with the "do shell script" access:
set thisMacroName to do shell script "echo $KMINFO_ThisMacroName"
set macroName to do shell script "echo $KMINFO_MacroName"
set thisGroupName to do shell script "echo $KMINFO_ThisMacroGroupName"
set groupName to do shell script "echo $KMINFO_ThisMacroGroupName"
And FWIW:
If you are already loading the:
use framework "Foundation"
You can bypass "do shell script" and AppleEvent calls and get any number of variables via environment variables into your script in one line, albeit horribly verbose, with safely rendered international characters like this:
use framework "Foundation"
tell (current application's NSProcessInfo's processInfo)'s environment
set {trigger, triggerValue,thisMacroName,myVar} to (its objectsForKeys:{"KMINFO_Trigger", "KMINFO_TriggerValue","KMINFO_ThisMacroName",""KMVAR_App_FrontmostAppName""} notFoundMarker:"") as list
end tell
Now you can use the variables "trigger", "triggerValue", "thisMacroName", "myVar" as usual.
Note that you can mix any number of KMVar_ in there too, provided you specify them in the environment variable chooser.
So if you're already loading:
use framework "Foundation"
and can stand the verbosity:
4 variable values, zero AppleEvents.