Automation 自动热键在窗口上找不到图像

Automation 自动热键在窗口上找不到图像,automation,autohotkey,Automation,Autohotkey,我最近发现了AutoHotKey,这种脚本语言看起来很神奇 不幸的是,我无法让我的脚本在窗口上找到一个图像(在我的例子中是蓝钉)。 有人能帮我吗,我的剧本是: CoordMode, Pixel, screen CoordMode, Mouse, screen *ESC::ExitApp ImgFound := false while(ImgFound = false) { ImageSearch, ButtonX, ButtonY, 0, 0, A_ScreenWidth, A_Scr

我最近发现了AutoHotKey,这种脚本语言看起来很神奇

不幸的是,我无法让我的脚本在窗口上找到一个图像(在我的例子中是蓝钉)。 有人能帮我吗,我的剧本是:

CoordMode, Pixel, screen
CoordMode, Mouse, screen

*ESC::ExitApp

ImgFound := false

while(ImgFound = false)
{
  ImageSearch, ButtonX, ButtonY, 0, 0, A_ScreenWidth, A_ScreenHeight, *50 C:\Users\...\Documents\...\test.png
  if (ErrorLevel = 2)
  {
      MsgBox Could not execute script.
      ExitApp
  }
  else if (ErrorLevel = 1)
  {
    ImgFound := false
  }
  else
  {
      MsgBox Found.
      click, %ButtonX%, %ButtonY%
      ImgFound := true
  }
}





您的while循环是无法访问的代码。
遇到第一个热键标签时,代码执行停止。这就是所谓的

将热键定义移动到最底部。
(始终由热键标签定义的所有热键都会被创建,无论是否在自动执行部分)