长按/短按某个键?

问题描述 投票:0回答:1

我想这样做: 如果 Ctrl 被按下超过 200 毫秒(长按)

没什么事

如果按键按下时间小于200ms(短按),则发送(“a”)

我得到了这些:

~Ctrl:: {
    if KeyWait("Ctrl", "T0.2")
        Send("{Blind}a")
}

; or this :

~Ctrl:: {
KeyWait "Ctrl"
If A_TimeSinceThisHotkey < 200
Send "a"
}

他们都做了我想要的,但是当用 Ctrl 分配任何组合时,例如 (^x ^c ^z)

例如:

^k:: Send("b")

并且按得非常快^k它会发送“ba”

  • 我想要当按得非常快时 ^k 它只发送“b”而不是“ba”
  • 按下并释放 RCtrl 时间少于 200 毫秒时,它仅发送“a”

www.autohotkey.com/boards/viewtopic.php?f=82&t=123696

请帮忙解决问题!

scripting autohotkey
1个回答
0
投票
#Requires AutoHotkey v2.0

    ~Ctrl:: {
    if KeyWait("Ctrl", "T0.2") AND ( (A_PriorKey = "LControl") OR (A_PriorKey = "RControl") ) 
        Send("{Blind}a")
}

^k:: Send("b")

https://www.autohotkey.com/docs/v2/Variables.htm#PriorKey

© www.soinside.com 2019 - 2024. All rights reserved.