在 winkey 之后为任何可能的热键组合执行任务
Execute task for any possible hotkey combinations following winkey
我想要以 LWin 开头的任何可能的键序列来执行特定任务,例如:
LWin & a::
;Execute the task
或:
LWin & b::
;Execute the task
等等...
当然对于所有的键盘键,这样写是不可能的,所以我想到了这样的事情:
LWin & *:: ; * = KEY
KEY = %A_ThisHotkey% ; KEY is now = LWin & a (for example)
KEY := RegExReplace(Clipboard,"i)^lwIN & ") ; KEY is now = a
; The task that needs to be executed:
Send {LWin UP}
Send {%KEY% DOWN}
KeyWait %KEY%
Send {%KEY% up}
return
但问题是,不能那样使用通配符。如何实现?
*LWin::
Input, key, L1
if (ErrorLevel = "NewInput")
Send, {LWin} ; LWin was pressed alone: pass-thru
else if (IsLabel(key))
Goto, % key
else
Send, % "#" key ; pass-thru
return
*LWin UP::Input ; stop listening for secondary key
; Tasks defined here
s:
MsgBox, "s" task launched!
return
p:
MsgBox, "p" task launched!
return
我想要以 LWin 开头的任何可能的键序列来执行特定任务,例如:
LWin & a::
;Execute the task
或:
LWin & b::
;Execute the task
等等...
当然对于所有的键盘键,这样写是不可能的,所以我想到了这样的事情:
LWin & *:: ; * = KEY
KEY = %A_ThisHotkey% ; KEY is now = LWin & a (for example)
KEY := RegExReplace(Clipboard,"i)^lwIN & ") ; KEY is now = a
; The task that needs to be executed:
Send {LWin UP}
Send {%KEY% DOWN}
KeyWait %KEY%
Send {%KEY% up}
return
但问题是,不能那样使用通配符。如何实现?
*LWin::
Input, key, L1
if (ErrorLevel = "NewInput")
Send, {LWin} ; LWin was pressed alone: pass-thru
else if (IsLabel(key))
Goto, % key
else
Send, % "#" key ; pass-thru
return
*LWin UP::Input ; stop listening for secondary key
; Tasks defined here
s:
MsgBox, "s" task launched!
return
p:
MsgBox, "p" task launched!
return