Pause untill Custom Floating HTML Prompt window closes

I'm trying to let KB Maestro know when a Custom Floating HTML Prompt window has been closed.

Here's what I've tried so far:

I've given the Custom Floating HTML Prompt window a custom title, named 'customwindowtitle' by inserting this line in the HTML text:

<title>customwindowtitle</title>

That works; the custom title is visible in the window bar. My next step would be to let KB Maestro pause until the window closes. Normally I would do this with inserting the "Pause Until Conditions are Met" action with the following settings:

Pause Until Conditions are Met:
Any window title of:
Keyboard Maestro Engine
does not contain "customwindowtitle"


This doesn't work. It also seems that the Custom Floating HTML Window title is not listed through this method: SCRIPT: Get List of All Window Names of "Windowed" Apps using JXA (thanks @JMichaelTX!)

Any (other) ideas on letting KB Maestro 'know' when a Custom Floating HTML Prompt window has been closed?

I just noticed your post from 4.5 years ago. I'm sorry nobody responded. I guess forums never guarantee a response.

I presume you were talking about asynchronous windows, although you didn't say that. I don't think your questions makes sense without that assumption.

Here's one way to do what you want. This macro creates an asynchronous Custom HTML Prompt window, then waits for the user to close it (by using a loop to see if its buttons have disappeared), then makes a beep sound. There may be better ways, but I'm not an expert.

The "Pause" can probably be as low as 0.1 seconds, but that may depend upon the complexity of your Custom HTML Prompt. The Pause may be necessary since the HTML Window is created asynchronously.

I created a Nothing button to prove you can press that and it won't do anything until you "Close" the window with the Close button. I suppose you can also turn the frame on for the window (you didn't say if you wanted a frame or not) and if you close the frame, it will also be detected.

You have to make sure that the Javascript action has its "failure aborts macro" flag disabled. You may also want to disable "Notify on Failure."

You don't have to place the "Execute" action in the same macro, of course. You can have that code in a separate async macro. You just need to use the correct Window ID. You can probably place the Window ID into a variable if you like, although that may not be needed in many cases.

Create and Close Async Window Macro (v11.0.3)

Create and Close Async Window.kmmacros (4.1 KB)