[Solved] Close a User Prompt Window from Another Macro

I know that is is possible to Position a User Prompt Window that has been called by another Macro (by referencing "the front window" in the App, "Keyboard Maestro Engine"). But the same approach will not Close that same Prompt Window.

Here is an example to show what I mean:

EXAMPLE Close Prompt Macros.kmmacros (5.1 KB)

If the Macro "EXAMPLE Close Keyboard Maestro Prompt" is run, it calls the Sub Macro "SUB MACRO Prompt" then it is supposed to Centre that Prompt (which works) and then Close that Prompt (which doesn't work). Any ideas folks? Thanks as always!

image

image

Strangely, this does work if the "called" window is an Alert Window or a Display Text in a Window. It just will not close any Prompt for User Input Window.

And, it can Minimise the Prompt Window. Just the Close command doesn't work for User Prompt Windows.

EDIT:
I have managed to come up with a Solution (for anyone that is interested :grinning:)

I still don't know why the original approach in my first post doesn't work but the below works (it Positions the Prompt in the Sub Macro and then Closes the Prompt by Cancelling the Instance of the running Sub Macro).

EXAMPLE Close Prompt v2 Macros.kmmacros (4.5 KB)

image

image

Hey @Zabobon,

User prompts are interrogative and require a response. They are not designed to simply be closed.

If you look one over with UI Browser or the Accessibility Inspector from Xcode – I'll bet you a beer you won't find any action for closing.

-Chris

1 Like

Thanks @ccstone. Yes, that’s what I half suspected - thanks for confirming. Good thing is there is always a solution to anything in Keyboard Maestro :grinning: