Continue macro after submitting a Safari form

I have a macro that takes my input, then opens a URL based on that input. That URL is a form I have to complete and submit by clicking a Send button. However, I'd like the macro to continue running after I submit the form, and I'm not sure of how to do that.

When I submit the form, the same form reloads; the only differences are some text that explains what was just submitted, and the URL now contains a "&submitted=true" flag.

Is there some way that KM can identify when Safari has reloaded a page? About all I've come up with so far is a "Wait for user input" overlay that just sits there, waiting for me to tell it to continue. But that's a pain, because it steals keyboard focus and requires mouse movement.

I guess what I'm looking for is some sort of "while" loop that won't get in the way of my filling out the Safari form—i.e. "while URL does not contain submitted, do nothing ... otherwise, continue processing."

Any ideas?


Hey there, just off the top of my head I'm wondering if the Safari window's title changes when the page reloads...even a temporary change might be enough to use a pause until front window title is not ...or something to that effect.

I tried that, and it didn't work. So then I took out the Big Hammer™, and brute forced something :). It's ugly, and I wouldn't want to use it in a really complex macro, but for my needs here, it gets the job done:

Basically, once a second, I set a variable to Safari's URL. If it doesn't contain my submitted keyword, I do nothing. When it does, the macro does what it needs to do to finish up—in this case, just doing some trickery to restore my default Safari window size then closes the input form.

As I said, ugly, but it works!


Instead of that big hammer of a Repeat why not try this:

KM 0 2021-10-25_16-00-24

This will wait until your Safari page reloads and has the text &submitted in the URL.

It seems to work here...


Genius! I always forget you can run text checks on the built-in variables ... argh. Thanks so much.

Big Hammer has been put away for use another day.



@griffman so glad that 1) you were able to come up with a temporary solution (because sometimes that's all we need to give us more time to come up with something more elaborate) and 2) that @tiffle was able to provide a better (and much simpler) solution!


1 Like

Thanks for the shout out Chris (@cdthomer) but I just ran with your idea…