Automagically click each instance of any button/image on the screen

What's this? Howdy. I recently suggested an action for a future update which would click each instance of any found image on the screen, but I've since found a way to do just that. Read on if you think that could be useful.

Imagine: You wish to automate some task which involves the opening of a variable number of web pages before performing a series of actions upon each opened page. Imagine this— boring and plain— sample page is your canvas:

Sure, you could take a screen shot of the "Manage" button and plop it in the Move and Click Action (middle clicking in order to open the page as a new tab):

Now that's neat, but it will only act upon a single instance of the found image (usually the upper-left one, in my experience). Are we finished? Is this it? Are we truly going to be subjected to this cruel, depraved reality in which we must click, link by link, unassisted, dragging our contorted, CTS-ravaged fist inch by inch over some filthy, oleaginous desktop?


I found this cool trick:

We use the Highlight Target action to temporarily obfuscate the first found image, leaving the next instance ripe for the finding. This needs to be it's own macro, for reasons I'll explain immediately after this screen grab:

See that Display for 6 seconds, right there? Turns out, this action will stay paused here for those entire 6 seconds, so we have to run it asynchronously within our master action in order to put its short-lived shroud to any use.

Behold, the master action:

Ah, read it and weep. For you have found salvation. But let's make it a bit neater. Wouldn't it be useful to know how many new tabs were opened upon the completion of the macro? Well, try incrementing a Count variable right there after the Move and Center Click action (One that was set to 0 before entering the While loop). Now, you can use that variable in one of these:

Then put that thing you wanted to do with each tab inside of that special hole, and enjoy your new life.

Please let me know if you have ideas to make this work better. Hope you found it useful :blush:

One could also use a modified version of this to gather coordinates from the screen in order to do some other kind of action. Perhaps to assemble an array of positions with which to manipulate an image in Photoshop. If I think of anything useful I'll be sure to update this.


Words fail me. That is truly brilliant.

Hopefully I will be able to add a “For Each matching Image” collection for 7.0, but in the mean time, that is very clever!

1 Like

I’m honored, @peternlewis. But it is, at the most, somewhat clever. Your software is the truly brilliant thing— it has transmogrified every tedious aspect of my job into an engaging puzzle. Illimitable gratitude to you and your team.


Agree with Kit_Langton about the KM software. It is solid, useful, and
capable beyond my poor abilities. And Kit_Langton, you are now part of the

Mike Briggs

Agree with all–inspired by the macro and grateful every day for KM!

I didn’t know about the “Find image on screen” action! Peter, what that action does isn’t obvious. Consider changing to “Save coordinates for image on screen” or “Find image on screen and save coordinates” :wink:

1 Like

Thanks, kind fellow. In case you didn't know, you don't always have to return the coordinates just to click on the screen. Here's something a bit more succinct:

Special Radiant Bonus Tip: To easily get an image into that special box, press ⌘⌃⇧4 to save a portion of the screen to your clipboard and then paste it right in.