Custom HTML Prompts - Inadvertently setting Global Variables 🤬

I've been creating Custom HTML Prompts since around 2015, if memory serves.

It just dawned on me that almost all of my Custom HTML Prompts call window.KeyboardMaestro.Submit() to close the prompt.

And I believe it's quite possible I've been inadvertently setting tons of global variables because of this. From the wiki:

Function Purpose
window.KeyboardMaestro.Submit(buttonName) submit the form and write the Keyboard Maestro Variables

As an example, I ran my "Variable Inspector Prompt" after running a Custom HTML Prompt I've been working on, and here's the global variables I accidentally created:

image

EDIT: I guess these variables only get created if I have HTML elements with the "name" attribute set, which I don't think I use a whole lot. The reason it's used in this Custom HTML Prompt is because I used ChatGPT to create the form dynamically, and it decided to set the name.

But having said that, I use VIP to check another prompt, and it sets some global variables also.

Crap. Looks like I've got a lot of work ahead of me to track down this kind of stuff.

1 Like

This is very much how the Custom HTML Prompt action is designed to work, since the initial and main purpose of the action was to allow more extensive and customised forms.

1 Like

Yep, I understand.