Autohotkey 如何使用特定的键重置键序列?

Autohotkey 如何使用特定的键重置键序列?,autohotkey,Autohotkey,因此,这个序列在1.5秒(t:=1500)后会自动重置,这意味着如果我在1.5秒内不点击鼠标左键,它将始终发送A。否则,它会在每次点击后发送下一个字母 我想进一步调整这个代码与另一个功能,这是能够重置序列与鼠标右键太。所以,如果我在任何时候按RButton,它都应该重置为A Thx 全局s:=0,c:=0,t:=1500 *按钮:: 发送%seqkey(“A”、“B”、“C”) 等等,按钮 发送,R 返回 Seqkeys(参数*){ 全球s、c、t max:=params.MaxIndex()

因此,这个序列在1.5秒(t:=1500)后会自动重置,这意味着如果我在1.5秒内不点击鼠标左键,它将始终发送A。否则,它会在每次点击后发送下一个字母

我想进一步调整这个代码与另一个功能,这是能够重置序列与鼠标右键太。所以,如果我在任何时候按RButton,它都应该重置为A

Thx

全局s:=0,c:=0,t:=1500
*按钮::
发送%seqkey(“A”、“B”、“C”)
等等,按钮
发送,R
返回
Seqkeys(参数*){
全球s、c、t
max:=params.MaxIndex()

(A_TickCount-s只需重置当前键索引“c”,以及上次单击的时间“s”:

*RButton::
    c := 1
    s := 0
return
我认为您的脚本将受益于更有意义的变量名:

global lastClickedTime:=0, currentKeyIndex:=0, clickThreshold:=1500

*LButton::
    Send % Seqkeys("A","B","C")
    KeyWait, LButton
    Send, R
return

*RButton::
    currentKeyIndex := 1
    clickThreshold := 0
return

Seqkeys(params*) { 
    global lastClickedTime, currentKeyIndex, clickThreshold
    max := params.MaxIndex()
    currentKeyIndex += 1

    if((A_TickCount - lastClickedTime) <= clickThreshold && currentKeyIndex <= max) {
        ; Do nothing
    } else {
        currentKeyIndex := 1
    }

    lastClickedTime := A_TickCount
    return params[currentKeyIndex]
}
全局lastClickedTime:=0,currentKeyIndex:=0,clickThreshold:=1500
*按钮::
发送%seqkey(“A”、“B”、“C”)
等等,按钮
发送,R
返回
*按钮::
currentKeyIndex:=1
单击阈值:=0
返回
Seqkeys(参数*){
全局lastClickedTime、currentKeyIndex、clickThreshold
max:=params.MaxIndex()
currentKeyIndex+=1

如果((A_TickCount-lastClickedTime)谢谢你的回答,它真的很有效。不知为什么人们不使用seqkeys命令很多,我真的找不到太多关于这一点的信息。我要把名字改对。再次谢谢!
global lastClickedTime:=0, currentKeyIndex:=0, clickThreshold:=1500

*LButton::
    Send % Seqkeys("A","B","C")
    KeyWait, LButton
    Send, R
return

*RButton::
    currentKeyIndex := 1
    clickThreshold := 0
return

Seqkeys(params*) { 
    global lastClickedTime, currentKeyIndex, clickThreshold
    max := params.MaxIndex()
    currentKeyIndex += 1

    if((A_TickCount - lastClickedTime) <= clickThreshold && currentKeyIndex <= max) {
        ; Do nothing
    } else {
        currentKeyIndex := 1
    }

    lastClickedTime := A_TickCount
    return params[currentKeyIndex]
}