Start a macro by clicking on a text box of a webpage

The topic is pretty much the question.
I find myself entering the same information into the text box of a certain web page and it is not information that the browser typically saves.

Is there a way to start a macro by clicking on a text box of a web page.

I don’t want to use Move or Move and Click becuase the box is not always in the same position.

You might well be able to do it by loading a specific page in e.g. Safari.

I don’t think so. See Triggers (KM Wiki) for your choices.

However, you can trigger a macro with a hotkey and/or a typed string.
I often use typed string as a text expander. So you could use something like:
;fieldname OR ;dataname
For example:
for my last name.

Then after you click in the web page text box, just type the KM typed string trigger.

For some good examples, see Topics tagged with “text_expansion”.

Hey Steven,

The way to do this is with a Set Safari Field to Text or Set Google Chrome Field to Text action.

If you’re using Safari or Chrome as your browser that is.

The actions have pop-up menus that show you the field names of fields Keyboard Maestro can see.

Sometimes the set field action can’t see the requisite field(s), but you can still set it/them with an Execute a JavaScript action.


However, those are Actions, NOT Triggers, so they cannot be used to trigger (start a macro) as requested by the OP.

Whether you use “Set Safari/Chrome Field” or a text expansion macro/action (like “Insert Text by Typing”), depends on you needs and apps and web pages.

The Set Safari/Chrome Field" is very specific to one field, and how it is named, and is likely to work only on one specific web page.

Whereas text expansion will work anywhere once you have clicked in the field or document where you want the info pasted.

For example, I have a text expansion for my email addresses which work on every web page and in every app.

Hey JM,

Yes, and that’s what Steven requested:

The trigger he wanted is not available, so I focused on the action he wanted to take.

Using JavaScript to auto-fill forms isn’t as flexible as text-expansion, but in the right venues it is far more efficient.

I use it routinely to fill out online insurance forms and such-like. It saves me time, but more importantly it ensures accuracy.

I’ve used text-expansion utilities for over 20 years and consider them indispensable — but they’re not always the right tool for the job.


I saved it as a trigger in the status bar.
Going up there and clicking on the Keyboard Maestro icon the macro is less moves and clicks than submission, but U have also used the typed string for something else and both work great.

Thank you.