Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
(In AutoHotkey, Ctrl is ^, Alt is !. You might clarify which one you want.) –  Bavi_H Jul 8 '10 at 2:02
    
I corrected the mistake. –  Mert Nuhoglu Jul 8 '10 at 6:17

1 Answer 1

up vote 7 down vote accepted

How about this?

Capslock & k:: 
GetKeyState, state, Alt
if state = D
SendInput !{Up}
Return 
share|improve this answer
    
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? –  Mert Nuhoglu Jul 8 '10 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 '10 at 12:41
2  
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 '12 at 17:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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