AutoHotKey - 如何多次发送控制和相同的密钥

时间:2017-12-04 15:54:39

标签: automation autohotkey

具体来说我想按住控制键,然后按m键,松开m但保持控制按住,然后再次按m,这将触发该功能。更一般地说,我想知道告诉autohotkey多次读取相同密钥的语法

我该怎么做?

我可以用这样的一个m来做到这一点

^m::
  Send, The text i want to send
Return

到目前为止,我已经尝试了

^m m::
  Send, The text i want to send
Return

^m&m::
  Send, The text i want to send
Return

^mm::
  Send, The text i want to send
Return

所有这些都是非法的

1 个答案:

答案 0 :(得分:2)

这个怎么样:

; Depending on how many times a key combination was pressed, 
; execute different commands:

^m::
    ctrl_m_count++          ; start counter
    SetTimer ctrl_m_action, -50
return

ctrl_m_action:
    KeyWait, Ctrl
    If (ctrl_m_count = 1)
        MsgBox, ctrl_m_action 1
    If (ctrl_m_count = 2)
        MsgBox, ctrl_m_action 2
    ; ...
    ctrl_m_count := 0       ; reset  counter
return