How do you pass an KM variable into Applescript then into Fscript?

want to delete this posst now

The code you show will create a variable in Keyboard Maestro with name Defendant and value DefendantKM.

It works fine for me when run from the Script Editor.

You can see the variable created and with its value in Keyboard Maestro in the Variables preference pane.

It will not read anything from Keyboard Maestro, nor set any AppleScript values.

To read a value from an existing Keyboard Maestro variable named Defendant, use:

tell application "Keyboard Maestro Engine"
	set v to value of variable "Defendant"
end tell

Then use the AppleScript variable vā€™s value as required.

1 Like

This worked great!

The above is old syntax (although it does still work)...

tell application "Keyboard Maestro Engine"
   set EnvVariablePath to getvariable "ENV_PATH"
end tell

Thanks. Updated and tested.

1 Like