Using a Numeric Variable in AppleScript

I'm trying to use a variable generated from "Prompt with List", let's say first item on the list returns a variable of "1" which I have saved to variable "colorName".

I am then passing this variable to an AppleScript to click a UI element named 'button 1'. However AS returns the error 'can't get button "1"', and what I need is for it to process as 'button 1', not button "1".

How do I remove the quotes from the variable that was passed to AS from KM?

Could you post the AppleScript itself so we can see where the issue might be?

All of Keyboard Maestro's variables are text, so when you pass one to AppleScript its class is text.

The solution is to set it to integer – similarly to this:

tell application "Keyboard Maestro Engine"
   set myIntegerVar to getvariable "someVar" as integer
end tell
1 Like

My apologies for the delay -- I was on the road away from computer. Thank you both for the reply and ccstone I will try your solution first!

Thanks again

1 Like