2
votes

The following autohotkey code

:*:\alpha::α

results in the hotstring text "\alpha" being continuously replaced by the corresponding UTF8 char "α".

However, it would be quite annoying to always have this replacement enabled. So I figured to activate it via the CapsLock key. So how do I enable the above hotstring only when the CapsLock key was pressed immediately before the string combination?

1

1 Answers

3
votes
; 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