Make a Change to the HTML Prompt Sample

There is this line of html code in the Custom HTML macro

button name="OK" type="button" onclick="window.KeyboardMaestro.Submit('OK')">OK

I would like to add something to have so that the O in OK would be underlined and if I press the command key? it would do the same thing as clicking the button.

Thanks
Roger

See the main HTML Prompt in the macro Mirror Mirror Macro for an example. There's a bit more to it than just the prompt (study the header's JavaScript). Oh, and I used CSS to style the underline but you can just use HTML, too.

Thanks

Good looking form. Did you write all of the first part the one big chunk of code?

I was able to get the underline to be displayed but your function made them work.

Roger

Yes, sorry about the format of the code. It's minimized to save space in the Keyboard Maestro plist file. Any number of site can unminimize it, I should have pointed out, so it can be read.

I will have to try this as my code seems to have slowed down.

One question how would you capture the return key?

Thanks
Roger

Take a look at the script's key handling and you'll see Enter is an alternative to Run

case 'Enter':case 'KeyR':window.KeyboardMaestro.Submit('Run');break;

(Handy key tester at KeyboardEvent Value.)

1 Like