AutoHotKey-如何多次发送控件和相同的键 [英] AutoHotKey - how to send control and same key multiple times

查看:276
本文介绍了AutoHotKey-如何多次发送控件和相同的键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

具体来说,我想按住Control键,然后按m键,放开m键,但保持按住状态不变,然后再次按m键,这将触发该功能.更笼统地说,我想知道告诉autohotkey多次读取同一键的语法

Specifically I want to hold down the control key, and press the m key, let go of m but keep control held down, and then press m again, which will trigger the function. More generically I'd like to know the syntax for telling autohotkey to read the same key multiple times

我该怎么做?

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

I can do it with a single m like this

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

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

So far I have tried

^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

所有这些都是非法的

推荐答案

这是怎么回事:

; 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

这篇关于AutoHotKey-如何多次发送控件和相同的键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆