ImageSearch unable to find image when in Chrome on second monitor

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
PumpkinShortie
Posts: 10
Joined: 14 Nov 2015, 13:17

ImageSearch unable to find image when in Chrome on second monitor

07 Sep 2018, 15:46

[Moderator's note: Topic moved from Bug Reports.]

Code: Select all

#KeyHistory 0
#InstallMouseHook
#InstallKeybdHook
;SysGet, leftMostPoint, 76
;SysGet, topMostPoint, 77
SysGet, totalWidth, 78
SysGet, totalHeight, 79
CoordMode, Pixel, Screen
CoordMode, Mouse, Screen
CoordMode, ToolTip, Screen

^esc::exitapp ; <- PANIC BUTTON (Ctrl + Esc)

global active := 0

NumpadSub::
    ImageSearch, foundX, foundY, 0, 0, totalWidth, totalHeight/2, *5 beachball.PNG
    if (!ErrorLevel) {
        SoundPlay, icq-uh-oh.mp3 , wait
        ToolTip, % foundX . ", " . foundY, foundX, foundY+25, 1
        active := 1
        while (active) {
            ImageSearch,,, foundX, foundY, foundX+20, foundY+20, *5 beachball.PNG
            if (ErrorLevel) {
                SoundPlay, icq-uh-oh.mp3 , wait
                sleep 10000
            }            
        sleep 750
    }
}

return
I have a dual monitor setup. The left monitor is the main monitor and is 2560x1080. The right monitor is the secondary monitor and is 1920x1080.

The above script is able to find beachball.PNG on both monitors if I have the file show in a file explorer window. However, this script is meant to detect the image in Chrome and the script only works if Chrome is on the main monitor. ImageSearch is unable to find the image if Chrome is on the second monitor.
guest3456
Posts: 3462
Joined: 09 Oct 2013, 10:31

Re: ImageSearch unable to find image when in Chrome on second monitor

08 Sep 2018, 00:48

do you use different scaling %s for each monitor?

PumpkinShortie
Posts: 10
Joined: 14 Nov 2015, 13:17

Re: ImageSearch unable to find image when in Chrome on second monitor

08 Sep 2018, 16:58

guest3456 wrote:do you use different scaling %s for each monitor?
I don't. Even if that was the case though, why would the script be able to find the picture when it's displayed in file explorer but not chrome? I just tested in Firefox and it's not working either.
gregster
Posts: 8988
Joined: 30 Sep 2013, 06:48

Re: ImageSearch unable to find image when in Chrome on second monitor

08 Sep 2018, 17:52

There might be transparent components of the png file, often the background, that are displayed differently in file explorer and chrome. Try to up the allowed variation and/or cut the image to the smallest distinct version possible (this should be done anyway)...
PumpkinShortie
Posts: 10
Joined: 14 Nov 2015, 13:17

Re: ImageSearch unable to find image when in Chrome on second monitor

09 Sep 2018, 10:32

gregster wrote:There might be transparent components of the png file, often the background, that are displayed differently in file explorer and chrome. Try to up the allowed variation and/or cut the image to the smallest distinct version possible (this should be done anyway)...
There is no transparency in that image. It's a screenshot I've taken myself. It works fine when Chrome is on the main monitor. It doesn't work in Chrome *only* on the secondary monitor.

Main monitor : Works in file explorer, Chrome and Firefox
Second monitor : Works in file explorer but not in Chrome or Firefox

And when I test in the browser, I test by opening the local file so the background is the same regardless of what size the window is.
PumpkinShortie
Posts: 10
Joined: 14 Nov 2015, 13:17

Re: ImageSearch unable to find image when in Chrome on second monitor

09 Sep 2018, 10:59

What I did find though, thanks to guest3456, was that in my video card settings, the color range on the second monitor was set to limited. So the color range was something like 8-254 bits instead of 0-256 bits. In fixing that I also removed the color profile that was on that monitor. I hadn't tested the script again after fixing the color on my second monitor. My first test was this morning. I went back to test the script in its "live environment" and the icon I was looking for had been slightly changed. So I had to take a new screenshot of the icon. Now it works on both screens! It is still very odd that it worked on one screen but not the other. I don't think it's the fact that I took a new screenshot of the icon. I wonder if by some freak computer thing, the color profile affected the colors displayed in the browsers on the second monitor, which led ImageSearch to be unable to find the icon on it. I had tried allowing a color variation of 10 and it didn't work though. Maybe I should have tried higher.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: jaka1 and 246 guests