【问题标题】:AutoHotKey not finding image on a windowAutoHotKey 在窗口上找不到图像
【发布时间】:2020-04-12 07:26:07
【问题描述】:

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

不幸的是,我无法让我的脚本在窗口上找到图像(在我的例子中是 BlueStacks)。 有人可以帮我吗,我的脚本是:

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
  }
}




【问题讨论】:

    标签: automation autohotkey


    【解决方案1】:

    您的 while 循环是无法访问的代码。
    当遇到第一个热键标签时,代码执行停止。这称为Auto-execute Section

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

    【讨论】:

      猜你喜欢
      • 2012-06-09
      • 1970-01-01
      • 2014-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-14
      相关资源
      最近更新 更多