Ever since I upgraded my monitor to a Apple Studio Display, my actions that include move or click mouse which look for a specific image usually a button and click on it, no longer work. I tried taking new screenshots of the images I wanted the click to happen on but it's just not seeing the images when the action runs.
Yes, switching monitors causes problems like this, because images are scaled/stretched to a specific resolution. (It can also be a problem if you are searching for the same image on two different monitors, or if you change the DPI on your single monitor.)
It is possible to scale/stretch your images using a built-in KM action. If you do this with the right value you can modify your image's "size", and I think that's done without changing the image's resolution, or losing any image data!
So with very little work, you could search for the same image on two separate monitors, even though the two monitors have two differing resolution, like this: (I've never tested this code, but I think it will work, if you use the correct DPI settings for your two monitors.)
Of course, you would also have to use a variable to indicated WHICH display the image was found on, and I didn't include that in this sample code.
I'm almost tempted to write a macro that handles this multi-screen image search, but since I don't need it myself, and nobody else likely does either, I may not write it.
You don't need to if the image has been pasted directly into the action's image, a file has been made from the Clipboard contents via Preview's "New from Clipboard", or similar. In all those cases KM appears to happily handle detection of the same image across different screen resolutions.
It seems to be only when people are screenshotting directly to file that there's a problem -- and even that is nuanced. I can happily capture a file from an area of my Retina display and still match it on my 72dpi second display, but capturing on the 72dpi display will fail to match on both.
Going the Clipboard route works regardless of where the image is captured or what screen it is being detected on.
It gets worse -- screenshot-to-file behaviour is inconsistent, not only between my two iMacs (both Intel Retinas with identical second monitors) but even test to test! That makes it quite difficult to troubleshoot...
Screenshot-to-clipboard then paste (or "Create New from Clipboard" if you want to go the file route) just works.
The only difference I can see is that screenshot-to-file doesn't include DPI info in the file's EXIF metadata while the other methods I can test do. If someone can directly extract the image from a pasted-into action's XML data, it would be interesting to see if that did...
This is the second time today your thorough testing and explanations of a problem have been highly illuminating. You must be or have been a professional software developer, because you have a very thorough testing methodology. (But I know you aren't The Architect of KM because I looked at some of your older posts and found actual mistakes!)
Not really a solution to what is being asked but I want to share how I approached this.
The action click on found image can also use a file to specify the image.
So I use a file to specify the image. The images are stored as follows:
As you can see the images are stored in an hierarchy as "Application/System name/resolution/image".
The Application is hard coded by the Macro that is requesting and the System name and the resolution are dynamically set. Obviously the image name is hard coded as well.
It makes that my macro's work across a number of systems without change.
Thanks to everyone who has responded! I'm not sure I follow the DPI advice, however as the day is gone on I realize that not all images are not found in my macros, it's just a few macros where the click on found image action isn't working.
The weird thing here is that, I'll take a new screenshot with the Mac screenshots tool, and update my macros with these new screenshots, but the action is still not finding these images in my browser, when I fire the macro..
Any thoughts? I'm always amazed at how helpful everyone here in this forum is!
Sometimes the solution to that is as simple as scaling the "bar" in the action further to the right (which gives you more fuzz factor.) Try it. That may be all you need. I have no idea why sometimes I need to do that.
I clicked on the image wells in your macro, then pressed the space bar to get a fuller display of the image. What I got was strange, at least for two of your four image wells. There was a red cross in two of your images.
I've never seen that before, and I have no idea what it means. I hope someone else here can explain it. (It could possibly explain your problem!!!)
P.S. In my opinion your macro is doing three things inefficiently or incorrectly:
You are searching the whole screen instead of the using an area to search only a fraction of it.
You are searching for each image twice, once to see if it's there and another separate time to click on it.
You are using an IF statement when the whole thing could be done in a single Click Image action, which, should it fail, do nothing because you can turn of Failure and Failure Display options.