tell application "Keyboard Maestro Engine"
set varlist to name of (every variable whose name starts with "QM")
repeat with delvar in varlist
delete variable delvar
end repeat
end tell
But in both cases they leave some of the variables existing, mostly when the value is empty.
When I do this script:
tell application "Keyboard Maestro Engine"
set varlist to exists variable "QMtrigger"
end tell
I get an empty list but I do see occurrences in the Variables List in KM preferences.
Also MichaelTX's script:
leaves me with empty variables in the Variables tab of Preferences.
I think I can work around this but it is confusing to me.
Somewhere on the forum Peter has explained why some variables will show up in the Preferences window, even if they’re empty. I can’t remember his explanation, nor find it at the moment, but here’s what I do to delete my variables. I run an AppleScript to set the variables contents to BLANK first, and then delete them. The example below shows how to delete all variables that are prepended with debug__. I’ve been doing this for a year or two with no issues.
set varName1 to "debug__"
set varAction1 to "BLANK"
set varAction2 to "%Delete%"
tell application "Keyboard Maestro Engine"
set value of variables whose name starts with varName1 to varAction1
set value of variables whose name starts with varName1 to varAction2
end tell
thanks
But it still looks like it fails here.
I first manually deleted the variables that start with QM in the preferences variables tab. Then I ran my macro a few times, and then I checked.
That way my suspicion, and I actually intended for you to run that AppleScript from within Keyboard Maestro, but it sounds like you got it figured out, kudos!
Don’t hesitate to reply if you run into any other issues!