AutoHotKey - ImageSearch两张图片

时间:2013-11-21 03:22:17

标签: autohotkey

有没有办法让AutoHotKey上的ImageSearch命令查找两个图像

目前我的代码是:

Loop
{
ImageSearch, wherexis, whereyis, 664, 556, 1364, 924, C:\Users\AHK Stuff\continue.PNG
If ! ErrorLevel
    {
        Click %wherexis%,%whereyis%
        break
    }
}
Sleep, 1400 

有时屏幕显示在图像上,有时则显示另一个屏幕,因此我的代码经常停止运行,因为它无法找到图像。如何制作“或”类型的声明以使ImageSearch查找两个图像并单击显示的内容?

谢谢!

1 个答案:

答案 0 :(得分:0)

如果找不到第一个,请做另一个图片搜索:

Loop 
{ 
    ImageSearch, wherexis, whereyis, 664, 556, 1364, 924, C:\Users\AHK Stuff\continue.PNG 
    If ! ErrorLevel 
    { ;If the first image was found:
        Click %wherexis%,%whereyis% 
        break 
    } 
    Else 
    { ;If the first image was not found:
        ImageSearch, wherexis, whereyis, 664, 556, 1364, 924, C:\Users\AHK Stuff\image2.PNG 
        If ! ErrorLevel 
        { ;If the second image was found:
            Click %wherexis%,%whereyis% 
            break 
        }
    }
    Sleep, 100
} 
Sleep, 1400