如何检测 AutoHotKey 中的热键后的下一个按键
How do I detect the next keypress after a hotkey in AutoHotKey
我想制作一个 AutoHotKey 脚本,其中发生以下事情,按 Win+Space 时的顺序.
- 记录Win+Space后的下一次击键
- 如果是g则Google开
- 如果是Esc则电脑被锁定
- (还有很多类似上面两个的条件)
我知道如何做所有这些事情,除了检测下一次击键 after Win+Space.
您可以使用 built-in 变量 A_PriorHotKey 和 A_TimeSincePriorHotkey 来检测下一个Win+Space 后的击键并检查最近是否按下了热键(否则它可能会在数小时后激活):
#Space:: return
; The #If directive creates context-sensitive hotkeys:
#If (A_PriorHotKey = "#Space" AND A_TimeSincePriorHotkey < 2000)
; If the hotkey was pressed recently (2 seconds)
; and g is pressed, then open google:
g:: Run https://www.google.com ; open google (duh)
#If ; turn of context sensitivity
我想制作一个 AutoHotKey 脚本,其中发生以下事情,按 Win+Space 时的顺序.
- 记录Win+Space后的下一次击键
- 如果是g则Google开
- 如果是Esc则电脑被锁定
- (还有很多类似上面两个的条件)
我知道如何做所有这些事情,除了检测下一次击键 after Win+Space.
您可以使用 built-in 变量 A_PriorHotKey 和 A_TimeSincePriorHotkey 来检测下一个Win+Space 后的击键并检查最近是否按下了热键(否则它可能会在数小时后激活):
#Space:: return
; The #If directive creates context-sensitive hotkeys:
#If (A_PriorHotKey = "#Space" AND A_TimeSincePriorHotkey < 2000)
; If the hotkey was pressed recently (2 seconds)
; and g is pressed, then open google:
g:: Run https://www.google.com ; open google (duh)
#If ; turn of context sensitivity