Autohotkey:热字串需要 Capslock

Autohotkey: Require Capslock for Hotstring

以下自动热键代码

:*:\alpha::α

导致热字串文本“\alpha”不断被相应的 UTF8 字符“α”替换。

但是,总是启用此替换会很烦人。所以我想通过 CapsLock 键激活它。那么,如何仅在紧接字符串组合之前按下 CapsLock 键时才启用上述热字串呢?

; The tilde prefix (~) prevents AHK from blocking key-down/up events.

~Capslock Up:: Send, {Capslock Up}


; The #If directive creates context-sensitive hotkeys and hotstrings:

#If (A_PriorHotkey = "~Capslock Up")

    :*:\alpha::α

#If

https://autohotkey.com/docs/commands/_If.htm