Newbie question about user input in the middle of a macro

So the macro that I am building is to enter some data onto a website. The website has a button for selecting items by search, I need to be able to enter a search parameter, then run the search (by pressing "enter") then continuing the macro. I am stuck on the entering text part and can use a little help. thanks in advance

No problem. First you have to select the field, then you have to enter the text, and then you have to submit the search.

For selecting the field, there are a few ways to do this, but the easiest to understand is to use the 'Click at Found Image' action.

First take a screenshot of the field you want to enter text into, and then drag it to the aforementioned 'Click at Found Image' action.

After that, use an 'Insert Text By Pasting' action to put whatever you want in there.

To submit the search, a 'Type a Keystroke' > 'Return' may do the trick. If not, then you need to use 'Click at Found Image' again to click the submit button.

Maybe sprinkle some in some pauses after each action and you should be able to get it working.

Let us know how it goes.

I will definitely put all that to use, the only potential problem is I need to enter something different each time, so "insert text by pasting" will not work, is there another command perhaps?


You could use the pause until action. Pause, manually type in the content, then hit enter. Have the condition for the pause until action set to “the return key is released”

1 Like

We can handle that but we have to know more. Where are you going to get these search terms from? Will you have a predetermined list or do you expect to get them as the macro is running?

I do what @vincent_ardern suggests quite a lot, it seems a bit crude but it works well once you get used to the timings and length of pauses you use.
In fact I mentioned elsewhere I put a cursor sometimes inside an 'insert by pasting'. Somewhere, I can't find it now, @peternlewis showed how you could use regex to fill that space and pick out text from elsewhere to do it. I can't say I remember how to do that, it wasn't something I needed at the time. Worth searching out though.

You can use the %|% token in an Insert Text action to have Keyboard Maestro move the cursor back to a specific position in the inserted text.

And you can use the Typed String trigger with the regex option to have the trigger include some part of text that you want to use, eg you could have =sup=whatever= expand to <sup>whatever</sup> by using a regex trigger of =sup=.*=.


Thanks again. I find the ability to place the cursor amazingly useful. I copied it out this time.

1 Like