[英]AHK Break Loop on Release and continue on keypress
我正在尋找調整附件腳本的建議。
當按下xbutton2時,執行循環並重復執行,但是我想像我想要的那樣停止循環。
理想情況下,我希望在釋放xbutton2時盡快停止循環。
此外,如果在按住xbutton2的同時按下某個鍵(或指定范圍的鍵),我希望循環跳到起點。
xbutton2 down = 1-(400ms)-2-(400ms)-3-(400ms)-4-(750ms)-5-(500ms)-等
發送3 = 1-(400ms)-2-(400ms)-3后xbutton2按下並釋放-xbutton2釋放
發送3 = 1-(400ms)-2-(400ms)-3 -X- 1-(400ms)-2-(400ms)等后,按下xbutton2並按x
SetNumlockState, Alwayson
#MaxThreadsPerHotkey 3
$*XButton2::
loop
{
if not GetKeyState("XButton2", "P")
break
Send {Blind} {1}
sleep 400
if (not GetKeyState("XButton2", "P")or GetKeyState("x", "P"))
continue
Send {Blind} {2}
sleep 400
if (not GetKeyState("XButton2", "P")or GetKeyState("x", "P"))
continue
Send {Blind} {3}
sleep 400
if (not GetKeyState("XButton2", "P")or GetKeyState("x", "P"))
continue
Send {Blind} {4}
sleep 750
if (not GetKeyState("XButton2", "P")or GetKeyState("x", "P"))
continue
Send {Blind} {5}
sleep 500
}
return
您可以嘗試從AHK論壇的以下示例開始:
list=a,b,c,{enter},string{click} ; the list of keys and combos. comma separated.
stringsplit, list, list,`,
Counter = 0
$F8::
While GetKeyState("F8","P"){
Counter := (Counter=list0) ? (1) : (Counter+1)
Send % list%counter%
Sleep 50
}
return
您可以使用其他熱鍵將計數器重置為“ 0”。 我認為以下可能對您有用:
list={Blind}{1},{Blind}{2},{Blind}{3},{Blind}{4},{Blind}{5}
stringsplit, list, list,`,
Counter = 0
$*XButton2::
While GetKeyState("XButton2","P"){
Counter := (Counter=list0) ? (1) : (Counter+1)
Send % list%counter%
Sleep 400
}
return
x::Counter = 0
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.