Passing Variables or Records to Keyboard Maestro

Is there a way I can use Applescript to pass a record or list of records or specific custom metadata fields to Keyboard Maestro?

I suppose saving to the system clipboard is one way but that probably works only for one particular item. If I want to pass several metadata items or several records how would I do that?

You can build an AppleScript record or a JavaScript object in DT. If and how you can work with such an object/record in KM, is probably a question for another forum.

Basically, you’d use one tell block for DT to build the record. Another tell block would then have to pass it to KM.

1 Like

Should be something like

tell application id "com.stairways.keyboardmaestro.engine"
	setvariable "myVar" to myAppleScript_string
end tell

but not at home so better check How to pass variable from applescript to km.

Note that if you get this variable via AppleScript from Keyboard Maestro then it’s a string.

1 Like

From the documentation

setvariable method : Set the value of a variable.
setvariable text : the variable
[instance: text] : the macro execution instance (from environment variable KMINSTANCE).
to: text : the variable value