键盘的快捷键一天天都不够用, 今天想用连续按下两次ESC或者Ctrl这样的条件, 来触发自定义事件.
(如同google desktop search那样)
再下面的帖子里面找到了正解, 以后用得着, 记录在这里.
Detect a double key press in AutoHotkey
响应连续两次按下Ctrl键, 弹出对话框提示
; Example #4: Detects when a key has been double-pressed (similar to double-click).
; KeyWait is used to stop the keyboard's auto-repeat feature from creating an unwanted
; double-press when you hold down the RControl key to modify another key. It does this by
; keeping the hotkey's thread running, which blocks the auto-repeats by relying upon
; #MaxThreadsPerHotkey being at its default setting of 1.
; Note: There is a more elaborate script to distinguish between single, double, and
; triple-presses at the bottom of the SetTimer page.
~RControl::
if (A_PriorHotkey <> "~RControl" or A_TimeSincePriorHotkey > 400)
{
; Too much time between presses, so this isn't a double-press.
KeyWait, RControl
return
}
MsgBox You double-pressed the right control key.
return
响应连续两次按下Esc键, 最小化Windows活动窗口
~Esc::
if (A_PriorHotkey <> "~Esc" or A_TimeSincePriorHotkey > 400)
{
; Too much time between presses, so this isn't a double-press.
KeyWait, Esc
return
}
WinMinimize, A
return
本文介绍如何利用AutoHotkey实现连续快速按下两次按键(如Ctrl或Esc)来触发特定操作的方法。通过设置双击事件,可以实现如弹出对话框或最小化当前活动窗口等功能。
24

被折叠的 条评论
为什么被折叠?



