How to chain sequence of Hotkeys in Autohotkey?
08:00 01 Apr 2021

I've been searching for the last hour here and in ahk's forum with no success, although I am sure this has been done and asked already somewhere. Maybe I am using the wrong terminology but, here goes the question:

I would like to create a few shorcuts sequences such that pressing a key combination as ^k (ctrl+k) enters a state where I have 1 second to press another key and get different results for each key. Preferably, it would work by pressing and holding ctrl and then k and then {a or b} while still holding k. And if I press ctrl+k and release, it sends ctrl+k to the application in focus, as usual.

^k then a::does something (with ctrl pressed down)
^k then b::does something else (with ctrl pressed down)
^k alone::sends ^k as usual

For those that use sublime, the behaviour I am after is the same as ctrl + k then b toggles the side bar. (I am sure other editors have similar behaviour)

I appreciate your attention and time.

keyboard-shortcuts autohotkey