@Tom, of course that gives an error, but you are taking one line out of context of the complete script shown on the wiki, and thus not accounting for the prior line:
set myKMVar to "My KM Var Name"
###The Complete Script on the Wiki
### Requires Keyboard Maestro 7.1+ ###
--- Set AppleScript Variables to KM Variable Name and Value ---
set myKMVar to "My KM Var Name"
set myASVar to "TBD" -- default value of KM variable, will be updated
tell application "Keyboard Maestro Engine"
### GET ###
-- IF KM Variable does NOT exist, the AS Variable will be set to empty string --
set myASVar to getvariable myKMVar
### SET ###
-- IF KM Variable does NOT exist, it will be created --
setvariable myKMVar to myASVar
end tell
Also, right below that, I show an example of using the KM Variable name explicitly:
tell application "Keyboard Maestro Engine"
set mainStr to getvariable "SCPT__MainString"
set subStr to getvariable "SCPT__StringToFind"
end tell
Perhaps this is a matter of style and/or preference, but I think the Wiki shows both methods, and the user can choose which he/she prefers.
Finally, any user who has previously used AppleScript to a reasonable degree will understand the concept of using either a variable or quoted text when an AppleScript command requires text data.
Let's see if we get comments from any other KM Forum users about this. I certainly want the Wiki to be clear and useful.
Thanks for your feedback and suggestions.