How to reset a key sequence with a specific key?

人走茶凉 提交于 2021-01-29 05:53:39

问题


So this sequence resets itself after 1.5 sec which means if i dont hit the left mouse button for 1.5 sec it always sends A.

I want to further tweak this code with another function which is to be able to reset it with right mouse button too. So if i hit RButton any time it should reset to A. THX

global s:=0, c:=0, t:=1500, t2:=380

*LButton::
    Send % Seqkeys("A","B","C")
    KeyWait, LButton
    Send, R
                If (A_TickCount-s < t2)
        c := 0
return

Seqkeys(params*) { 
    global s, c, t
    max := params.MaxIndex()
    (A_TickCount-s<=t && (c+=1)<=max) ? c : c:=1
    s := A_TickCount
    return params[c]
}

UPDATE: so i found this code with these variables so if i hit right click here it resets the sequence... How can implement this function to mine?

RButton::var:=0
LButton::
var++
If (var=1)
    Send A
else if (var=2)
    Send B
else if (var=3)
    {
    Send C
    var:=0
    }
return

来源:https://stackoverflow.com/questions/64796721/how-to-reset-a-key-sequence-with-a-specific-key

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!