16

I want to combine CapsLock Alt k keys in a single hotkey, such as this:

CapsLock & !k:: Send !{Up}

This doesn't work because Autohotkey doesn't allow the combination of more than two keys except the modifier keys.

Searching for a solution I found out that using scan codes in left hand side might be a work around, such as:

SC035 & !k:: Send !{Up}

I tested this solution too but this doesn't work properly neither. In this case, pressing CapsLock+k triggers the hotkey.

2
  • (In AutoHotkey, Ctrl is ^, Alt is !. You might clarify which one you want.)
    – Bavi_H
    Jul 8, 2010 at 2:02
  • I corrected the mistake. Jul 8, 2010 at 6:17

1 Answer 1

15

How about this?

Capslock & k:: 
GetKeyState, state, Alt
if state = D
SendInput !{Up}
Return 
3
  • Thank you. This works really. But now there is a slight delay when using CapsLock combined with a key, such as "CapsLock&a::=". This delay is probably due to GetKeyState function, isn't it? Jul 8, 2010 at 7:23
  • I tested, but could not recreate this delay. The script should be self-contained and not affect the performance of other scripts. Scripts that have GetKeyState to add a third hotkey (like the one I have above) will not behave exactly like scripts with normal hotkey setups and may prevent the script repeating as fast as usual. Hope that helps.
    – snitzr
    Jul 8, 2010 at 12:41
  • 3
    I prefer this more concise syntax and thought I'd share it with you: if not GetKeyState("Alt", "P")... Modify according to your needs. Cheers.
    – Mario Awad
    Jun 27, 2012 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.