【问题标题】:Autohotkey Button with loop带循环的自动热键按钮
【发布时间】:2022-11-27 05:12:31
【问题描述】:

我有个问题。我已经创建了一些按钮,但是当我启动一个按钮时,它不会启动循环。我如何为适合 %edelstein% 的按钮设置变量 谢谢你的帮助

#NoEnv
#SingleInstance Force
SetWorkingDir %A_ScriptDir%
SetBatchLines -1
^k::
Gui, Add, Button, x32 y29 w90 h40 , Diamand
Gui, Add, Button, x152 y29 w90 h40 , Flawless Diamand
Gui, Add, Button, x272 y29 w90 h40 , Perfekter Diamand
Gui, Show, w479 h379, Untitled GUI
InputBox, count,
Loop %count%
{
    ImageSearch, found_x, found_y, 0, 0, 1200, 1200, *100 %edelstein%.png
    if (!ErrorLevel)
    {
    Send, {Control down} 
    MouseClick, left, %found_x%, %found_y% 
    Send, {Control up} 
    
    }

我尝试使用不同的 y 标签,但它总是跳过循环

【问题讨论】:

    标签: loops user-interface button autohotkey


    【解决方案1】:

    Documentation永远是你最好的朋友。

    #NoEnv
    #SingleInstance, Force
    SetWorkingDir, %A_ScriptDir%
    SetBatchLines, -1
    
    Gui, Add, Button, x32 y29 w90 h40   vDiamand            gOnButtonClick, Diamand
    Gui, Add, Button, x152 y29 w90 h40  vFlawless_Diamand   gOnButtonClick, Flawless Diamand
    Gui, Add, Button, x272 y29 w90 h40  vPerfekter_Diamand  gOnButtonClick, Perfekter Diamand
    Gui, Show, w479 h379, Untitled GUI
    
    edelstein := "ImageName"
    Return
    
    GuiClose:
    ExitApp
    
    OnButtonClick:
        Msgbox, % A_GuiControl
    Return
    
    ^k::
        InputBox, count
        Loop, %count% {
            ImageSearch, found_x, found_y, 0, 0, 1200, 1200, *100 %edelstein%.png
            
            if (ErrorLevel = 2)
                MsgBox, 16,, Could not conduct the search.
            Else if (ErrorLevel = 1)
                MsgBox, 16,, Icon could not be found on the screen.
            Else {
                Send, {Control down} 
                MouseClick, left, %found_x%, %found_y% 
                Send, {Control up} 
            }
        }
    Return
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-31
      • 2018-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-01
      相关资源
      最近更新 更多