使用Autohotkey创建时间敏感的键盘快捷键

时间:2016-01-14 23:39:37

标签: autohotkey

我按下Ctrl-Alt-I然后按下p,k或u键,使用以下脚本运行一堆命令。如何将此更改为等待下一个键的2秒钟,或者只是发送Ctrl-Alt-I并停止等待下一个键

^!i::
Input key, I L1
IfEqual key,p
   Run, "C:\Temp"
IfEqual key,k
   Run, "C:\Temp\1"
IfEqual key,u
   Run, "C:\Temp\2"
Return

1 个答案:

答案 0 :(得分:1)

喜欢这个吗?

$^!i::
    Input key1, I L1 T2 ;wait 2 seconds for a keypress
    If (key1 = "p" || key1 = "k" || key1 = "u") { ;if p, k or u were pressed
        If (key1 = "p") { ;if the first key we waited for was p:
            Run, "C:\Temp"
        } Else If (key1 = "k") { ;if the first key we waited for was k:
            Run, "C:\Temp\1"
        } Else If (key1 = "u") { ;if the first key we waited for was u:
            Run, "C:\Temp\2"
        } Else {
            SendInput, ^!i
        }
    }
Return