Image Search not working on 1 monitor

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
arathra
Posts: 23
Joined: 29 Aug 2016, 06:22

Image Search not working on 1 monitor

30 Apr 2021, 08:00

Is there any reason why ImageSearch might not work on one particular monitor but it will work on another when the AHK script is exactly the same?

I took a screenshot on PC 1 of a small area of the screen and put it into a PNG file. ImageSearch finds it on PC 1 monitor no problem.

I took a screenshot on PC 2 of the same area of the screen and put it into a PNG file. ImageSearch does NOT find it on this second PC & monitor and returns Error 1, even when the coordinates are set to 0, 0, A_ScreenWidth, A_ScreenHeight
Last edited by arathra on 30 Apr 2021, 08:07, edited 1 time in total.
User avatar
mikeyww
Posts: 27366
Joined: 09 Sep 2014, 18:38

Re: Image Search not working on 1 monitor

30 Apr 2021, 08:05

Would double-check the file path and coordinates that you are using. Try cropping to a smaller area of the image. I am assuming that the display (monitor) in the test & the capture was the same. If you are not changing the CoordMode, then the target window would typically need to be active, unless you have adjusted the coordinates accordingly. If it does not work, then try a new, small, plain image with no transparency. Capture, display, & test. Post your script for feedback about it. Test on your native or first display.
User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: Image Search not working on 1 monitor

30 Apr 2021, 10:11

The key difference is different PCs, not different monitors, other than the possibility that having a different (higher-res) monitor has led you to use a different Windows scaling setting. Do you perhaps have a difference in scaling factors between the two PCs, such as 100% on one and 150% on the other?

Also, if your captured screen area contains text, especially antialiased text, then that could be rendered differently on the two machines.
arathra
Posts: 23
Joined: 29 Aug 2016, 06:22

Re: Image Search not working on 1 monitor

01 May 2021, 23:11

Thank you for your replies and suggestions.

It took a long time and a lot of fiddling but I did get it to work in the end. And I'm a bit embarrassed to say it mainly my fault - an errant bit of code changed the settings on one PC

Code: Select all

if ( PC identifier == XYZ )
   change viewport settings
Ho hum... :oops:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mstrauss2021, Spawnova, zephyrus2706 and 352 guests