Using Firefox (or any other browser) to load KM Variables with user prompts

Some of you might benefit from a (hopefully easy to follow and customize) example of how to use Firefox (or any other browser) to input KM variables.

KM's Custom HTML Prompt is quite powerful, but it has some shortcomings. For example, dropdowns aren't invoked with a down-arrow, autofocus does not work, and neither does using Tab to simultaneously choose from a dropdown then advance to the next input. Firefox, on the other hand, allows me to autofocus whichever form input I want. Also, in Firefox, once I use arrow keys to make my choice for an input (like a dropdown), hitting Tab will select that choice and advance to the next input (saving me a Return stroke for each input). I often use HTML to prompt for input of variables that I use in various KM macros, so I wrote the following macro to allow for Firefox to render the HTML. Javascript (within the HTML file) collects the variables, then the KM macro retrieves the variables.

There are a couple of preliminary steps you'll need to take:

  1. Create the GenericBrowserFormForKM.html file (described in the macro's first action, in red), and save it to your machine. Once you get the macro running, you can customize the HTML file to your particular needs, but keep it as is for a demonstration.)
  2. Correct the path names in the macro actions to point to your copy of GenericBrowserFormForKM.html. Do this by replacing the ~TheParticularPathForWhereYouSavedTheFile part of the path.

Browser-based KM Variable Loader Macro (v9.0.5)

Browser-based KM Variable Loader.kmmacros (44 KB)

Once you get this running in Firefox, try opening the HTML file with Safari to notice how many more keystrokes are needed in Safari (and other browsers) to navigate the inputs, compared to Firefox.

I forgot to mention that the macro is set up to wait for the \ key. When it is pressed, KM will automatically close the page and process the variables.