如何在自动热键中分配两次按Alt键(Alt + Release + Alt)的热键? [英] How to assign hotkey of pressing Alt key twice (Alt+Release+Alt) in Autohotkey?

查看:183
本文介绍了如何在自动热键中分配两次按Alt键(Alt + Release + Alt)的热键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何分配在Autohotkey中快速按两次{Alt} 的热键?

换句话说:如何将Press Alt + Release Alt + Press Alt分配为热键?
换句话说:如何分配按下{Alt}键然后按下{Alt}键然后迅速 按下{Alt}键?

How to assign a hotkey of quickly pressing {Alt} key twice in Autohotkey?

In other words: How to assign Press Alt+Release Alt+Press Alt as a hotkey?
In other words: How to assign key down {Alt} key then key up {Alt} key then quickly key down {Alt}?.

我想设置释放{Alt}键然后再次按下(非常小)之间的时间,以激活热键.
•示例::如果用户按下{Alt}键然后释放它,然后等待5秒钟,然后再次按下{Alt}键,则该热键根本不起作用或处于活动状态.但是,如果他在1.5秒之前再次按{Alt}键,则该热键将起作用.我希望能够设置这次.
•类推:类似于双击鼠标按钮并设置从第一次单击到第二次单击之间的时间,以便触发双击动作.但是我要寻找的是设置双击键盘键.

I want to set the time between releasing {Alt} key then pressing it again (to be very small) in order to activate hotkey.
• Example: if the user pressed {Alt} key then released it then waited for 5 seconds then pressed {Alt} key again, the hotkey shouldn't be working or active at all. But if he pressed {Alt} key again before 1.5 seconds, then the hotkey will work. I want to be able to set this time.
• Analogy: it's something like double clicking a mouse button and setting the time between 1st and second click in order for the double-click action to be triggered. But what I'm looking for instead is setting a double click for a keyboard key.

推荐答案

使用以下简单脚本:

LAlt::
    If (A_PriorHotKey = "LAlt") AND (A_TimeSincePriorHotkey < 200){
        Send, {LAlt Down}
        KeyWait, LAlt
        Send, {LAlt Up}
    }
return

if语句将检查在最近的200毫秒内是否已使用过LAlt热键,如果已使用,它将按住LAlt键,而当LAlt实际上升时(释放键) ),它将在OS中反映相同的内容. 否则,它将不执行任何操作,例如,如果序列为LAlt,再按其他某个键,然后再按LAlt,则该序列将不起作用,或者如果按下LAlt的时间间隔不够快(大于200 ms),它也不会处于活动状态.

The if statement will check if the LAlt hotkey has been used in the last 200 milliseconds, if so, it will hold LAlt key down, and when LAlt physically goes up (you release the key), it will reflect the same in the OS. Otherwise, it will do nothing, for example if the sequence was LAlt, some other key then LAlt again, it won't active, or if the time between pressings of LAlt was not quick enough (more than 200ms) it will also not active.

这篇关于如何在自动热键中分配两次按Alt键(Alt + Release + Alt)的热键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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