Autohotkey 针对winkey之后的任何可能的热键组合执行任务

Autohotkey 针对winkey之后的任何可能的热键组合执行任务,autohotkey,Autohotkey,我希望以LWin开始的任何可能的键序列执行特定任务,例如: LWin & a:: ;Execute the task 或: 等等 当然,对于所有的键盘键来说,写这些都是不可能的,所以我想到了这样的事情: LWin & *:: ; * = KEY KEY = %A_ThisHotkey% ; KEY is now = LWin & a (for example) KEY := RegExReplace(Clipboard,"i)^lwIN & ")

我希望以LWin开始的任何可能的键序列执行特定任务,例如:

LWin & a::
;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

但问题是,通配符不能这样使用。如何实现这一点?

您希望它特定于特定的活动窗口吗?您是否需要能够取消绑定(例如,按Esc)?@JoeCoder是的,我在实际代码中使用了#IfWinActive,我认为我不需要取消绑定。我花了很长时间才完全理解它xD,但现在我明白了,它工作得很好,非常感谢:D
*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::
    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