AutoHotKey:如何检查是否存在带有特定标签的按钮?


0

我有两个Windows,它们具有相同的窗口类和标题文本。唯一的区别是一些按钮在一个而不是另一个。使用AutoHotKey,如何给出标签(文本),我如何检查是否存在按钮?按钮的窗口类不是唯一的。

Answers:


1

我通常使用ImageSearch来检查按钮的存在。

WinGetPos, , , Width, Height, A ;This gets the active window's size
Loop ;This loop searches for the button.
{
    ImageSearch, FoundX, FoundY, 0, 0, Width, Height, %A_WorkingDir%\button.png
        If ErrorLevel = 0
        {
           Msgbox, I found the button at %FoundX% %FoundY%.
           break ;break the loop when the image is found
        }
    Sleep, 500
}

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.