Custom HTML Result Button Value When Prompt Is Closed

How do I set the HTML Result Button "default" for closing the prompt using the close box or by hitting "ESC" from the form?

The Result Button is cleared at the start of the Prompt For User Input action, and then set if any button is pressed, so it will be empty if you close it some other way.

Note that pressing “Escape” is the same as pressing Cancel, at least by default.

1 Like

It looks like the HTML Result Button variable is NOT cleared when the action is run. If I explicitly clear it beforehand, it works as I'd expect. I'm calling this a bug since it's an inconsistency between the two prompt actions.

Here's an example macro of the bug:

HTML prompt demo.kmmacros (5.3 KB)

Yes, this is a known bug and will likely be fixed for 7.0.4.

I know this is a VERY OLD post, but I've only recently discovered the Custom HTML Prompt feature and have modeled my macro after JMichaelTX's (RIP) demo and notice that neither his nor my macro have the HTML Result Button set the same as Cancel when ESC is pressed using Keyboard Maestro 9.2 on macOS 10.14.6. Does something need to be added to capture the Keyboard Maestro result variable when escape is pressed?

Execute AppleScript To Demo Custom HTML Prompt

Execute an AppleScript.kmactions (7.7 KB)

Hey Anthony,

Your posted action fails to run at all when ensconced in a macro.


Apologies to Chris et al,

I only provided one portion of the KM macro of JMichaelTX's demo. In order to see the issue, one must have the other two files that he provided as part of the demo. Jim provided the attached zip file.

[KM] DEMO KM HTML Form Set by (18.2 KB)

For a full explanation, see his post here. Pressing ESC from the user prompt doesn't seem to have the HTML Result Button captured as intended.

How do you know this is the intended function of ESC?

Normally it means to Escape from the given UI.


After re-examining the wiki, it indicates that things changed after 7.01 and the KM variables are cleared at the initiation of the prompt and no KM variables are set if the user presses ESC, so HTML Result Button will not have the prior set value.