A possible alternative to "Click at found image"

This is one of those obvious things, but maybe it'll help someone...

There are times when I thought the only way to click somewhere in a given window was through a Click at Found Image action. But if the window's shape differs from run to run, it's possible the image might not be found due to being in a tougher-to-spot location, or possibly not even onscreen.

To work around this, and to get away from using found image at all (as many images aren't distinct enough to find), I now tackle this problem in a different way: I standardize the window, which means I can then click at a specific location in that window (assuming that the content hasn't changed; i.e. this isn't perfect for web pages which change a lot, but works great for app windows). Then when I'm done, I put the window back where it was.

After activating the app I want to work with, the basic macro looks like this:

Keyboard Maestro Export

I've found this works really well for me in lieu of finding images. With a known window size, it's easy to click exactly on the item of interest without having to find the image representing that content.

It's definitely not the solution for often-changing-content layouts; for that, you'll need found image. But for other stuff, this method works great for me.

Keyboard Maestro Actions.kmactions (4.5 KB)

-rob.

8 Likes

I'd be curious to know exactly what scenarios click at found image do not work for you since it's designed to solve pretty much this problem.

You should be able to increase the 'fuzz' if it can't find an image.

EDIT:
One other thing is that if you're clicking on window elements, the app ShortCat works great for that

The web page for our cart provider has light gray buttons with white text on a lighter gray background. They're incredibly stupid, and incredibly hard for KM to see.

I ran into the same issue trying to write a macro for Zoom for a buddy—we had to click on a toggle that comes out in a panel with 10 identical toggles. Each is labeled, of course, but the state of the toggle is unknown, so it might be a gray button or a blue button. So it would have required checking two found images. It seemed simpler to just move the window and click at an always-known location, then move it back.

I've seen that before, though in my case, I prefer to keep everything within one app, and since I spend so much time in KM already, this just made sense. And for my friend, the Zoom button was just one step of a long macro that does a bunch of stuff (unmounting servers, sending some email, changing some other apps' windows, checking Time Machine status, etc.), most of which is right in KM's areas of expertise.

-rob.

1 Like

Hey griffman,

Why not use the Keyboard Maestro action Move and Click? Change the "relative to the" option to "front window's top left corner." In Keyboard Maestro, go to Window > Mouse Display. Click on the inner top left corner to show the coordinates of the mouse in the front most app. Make sure the target app is in focus. Hover your mouse over the spot you want KM to click. Use those values in the Move and Click action.

Using the above, you don't have to resize your app first. Unless of course, the content dynamically moves around based on size.

Exactly that: The window is resizable, and I have no idea what size and shape the user has chosen for it. The buttons could be anywhere. Making the window a fixed size was the only way I could be certain that the move and clicks happened where they had to happen.

-rob.