Apologies, I've been here before and believe I was supplied with a solution, although I cannot find it in my database or on the forum.
Is there a way to call a KM variable into the javascript action?
So that instead of the subject being the 'hard coded' "MY TEST" , it could be the value of a KM Variable that I have stored?
For JavaScript executed in browser contexts, Keyboard Maestro provides (read-only) access to variable names and their values by initialising a document.kmvar object.
You can read its keys and values in the usual way, but you can't change KMVAR values through it.
If I have, for example a KM variable named 'scratchpad':
(For JS executed in a JavaScript for Automation context, there are both kmEngine.getvariable and kmEngine.setvariable methods, but these are not, of course, available in browsers)
For a panoptic view of the contents of document.kmvar, you could also, of course, write: