Autohotkey - ImageSearch

2.2k Views Asked by At

I m trying to test a GUI by comparing my current screen with an image of the required screen and seeing if they match. I m using ImageSearch of AutoHotKey for this.

CoordMode, Pixel
ImageSearch,x,y,0,0,A_ScreenWidth,A_ScreenHeight,*255 C:\Documents and Settings\XYZ\Desktop\AutoHotkey\help window.bmp
if ErrorLevel=1
    Msgbox 0,Fail,Fail
if ErrorLevel=0
{
    MouseClick, left,  50,  191
    Sleep, 100
}

I keep getting an ErrorLevel =1. Any suggestions on how I can resolve this.

Thanks

1

There are 1 best solutions below

0
On

The *255 is messing you up. This basically nullifies the image search, since everything on the screen will match the image. Try something lower. It's unlikely you should need higher than *100

Also, as a general tip, try using the smallest possible version of the image you're searching for.