4

How can I create an Alt + Space + C shortcut in autohotkey? Alt + Space is !space but I don't see how I can add a third key without getting an error.

Amati
  • 1,484
  • 1
  • 16
  • 29

1 Answers1

7

You can use the #If directive (requires AHK_L) in combination with the GetKeyState() function:

#If GetKeyState("Alt", "p")

Space & c::Traytip,, % a_thishotkey

#If

or you can use the Keywait command:

!space::
keywait, c, d, t0.6
If ErrorLevel
    Traytip,, Alt and space
Else
    Traytip,, Alt space and c
Return

This will also trigger an Alt+space outcome after 0.6 seconds if you don't press C.
If that is undesirable you can write it like this:

!space::
keywait, c, d, t0.6
If (!ErrorLevel) {
    Traytip,, Alt space and c
    Sleep, 2000
    Traytip,, % a_thishotkey
} Return

!ErrorLevel means "not ErrorLevel"

Honest Abe
  • 8,430
  • 4
  • 49
  • 64