Execute JavaScript in Custom Prompt Question

So I just stumbled across the "Execute JavaScript in Custom Prompt" action. Very cool.

Here's how I'm using it, then I have a question:

I have a Custom HTML Prompt that I launch with a hotkey. If the prompt is already open, I close the prompt then do something else. Here's my action that closes the prompt.

(The function "cancelWindow" is a JS function of mine, in the Custom HTML Prompt.)

The action does just what it's supposed to do. The problem is, it always reports "Timed Out". Obviously I can turn off the timeout notification, and I have.

But why does it time out? What is it waiting for?

Thanks.

1 Like

Dan, thanks for posting this.

I have been wondering what the purpose, what the use case is, for this Action.
Your post make it clear:

"Execute JavaScript in Custom Prompt" action is the functional equivalent for the Custom HTML Prompt to the existing actions:

To All:

Please review this update to the KM Wiki:
action:Execute a JavaScript in Custom Prompt [Keyboard Maestro Wiki]

Not sure how to do this, or I'd do it myself. The one question I had to do a minor amount of digging to find, was what was meant by "windowid" in the statement:

The JavaScript is executed in a specific Custom HTML Prompt action with a matching windowid, or all Custom HTML Prompts if no windowid is specified.

I found the answer on this page:

https://wiki.keyboardmaestro.com/action/Custom_HTML_Prompt

Here:

So I think it might help to link to that.

Otherwise, it's all good.

1 Like

Thanks for the suggestion. Link added.
Execute JavaScript in Custom Prompt Action

It times out because the window closes so the action never gets its results back. You have configured the action for “ignore results”, but that still waits for the results to return, which they never do. If you want it to not wait, configure it for “asynchronous”.

1 Like

FYI, for anyone who might read this, the "asynchronously" option is here: