I've highlighted a portion of text in that image; the value 650. I'd like to subtitute that value with a KM variable that one can set beforehand, but can't see a way to do this given that the text script editing field is one of the few types of input fields in KM that doesn't process text tokens.
Perfect. Thanks for pointing me to the relevant documentation. I missed that entirely, and didn't know one can retrieve KM variables through the browser in this manner. Many thanks.
But even then, the JavaScript variable "frm" is undefined, so it will fail.
You need to get a reference to "frm", perhaps using document.querySelector()
But it is hard to say without knowing more details, including the HTML of the target web page.
As described in the Execute a JavaScript in Google Chrome documentation (which you can get to from the Help menu in the action (gear) menu), the Keyboard Maestro variables are available to the script as:
document.kmvar.schedule_command
This is plain text in the variable, so you will need to run the command - I don't know how to do that I'm afraid. eval maybe? Alternatively, you could do something like: