如何改变循环?

时间:2019-04-03 02:03:46

标签: autohotkey

脚本正在剪贴板中搜索特定文本。找到后,它会显示一个MsgBox。

我希望该脚本在找到文本后停止。如何实现?

#Persistent

MouseMove, 821, 700
Sleep, 500
MouseClick, Left
Sleep, 500
Loop, 5
{
Send, ^c
Sleep, 500
Send, {PgDn}
}

OnClipboardChange:

 If InStr( Clipboard, "Part3" )

    SetTimer, PopupMsgBox, -1

Return



PopupMsgBox:

 Msgbox, Part3 Found

Return

1 个答案:

答案 0 :(得分:0)

#Persistent

clip_search := "Part3"

MouseMove, 821, 700
Sleep, 500
MouseClick, Left
Sleep, 500
Loop, 5
{
  Send, ^c
  ClipWait
  If InStr( Clipboard, clip_search )
  {
    MsgBox, % clip_search " Found."
    Break
  }
  Sleep, 500
  Send, {PgDn}
}