How can I close, via KM, a "Custom HTML Prompt"

Hello all,

This should be an easy one but I’m not having much luck.

Goal: Pop open a bright red alert box in Macro A that shows until I execute Macro B.

I have a macro that pops open a “Custom HTML Prompt”. I figured that’s the right tool for the job. Is there any way for me to close that HTML prompt using Keyboard Maestro?

Yep.

In the Custom HTML Prompt, give it a data-kmwindowid property, like this:

<body data-kmwindowid="MyWindowId">

Then use an "Execute JavaScript in Custom Prompt" action, to execute some JavaScript that does whatever it is you need to do to close the prompt, like this:

4 Likes

Ah! This is excellent. I should’ve spent some time reading through the documentation for Custom HTML Prompt. I was able to get the window to cancel using window.KeyboardMaestro.Cancel()

Thanks for the help. This is fantastic!

1 Like

Great! If you get a chance, mark this question as having been answered. Thanks!

Done!

1 Like

Awesome. But is there a way to check if Custom HTML prompt window exists or not and then close if exists.

Sometimes I manually close window but then when Macro triggers I get an error

You can turn off the error notification and aborting in the gear menu.

1 Like

perfect. Thanks.