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 know how to use Autohotkey to remap keys and key combinations. If I bind Capslock to Ctrl, Capslock+Anykey will work like Ctrl+Anykey.

How can I bind CapsLock alone to another hotkey (Ctrl+1, for instance), but bind Capslock+Anykey to Ctrl+Anykey ?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Okay, I have an imperfect workaround:

Capslock::Control  ;--Holding Caps = holding Ctrl

Capslock Up:: ;--If you press Caps fast, it types "No"
SendInput, {Control Up}  ;--For stability
If A_TimeSincePriorHotkey < 100  ;--Vary the time as it suits you
{
Sendinput, No  ;--Replace with what you want Caps to do on its own
}
Else
return
return

If you press Caps down for longer than 100 ms, then release it, nothing will happen. If you press it for less then 100ms, then release it, it will type "No". If you press any Key while holding it down, it will carry out control+Key. If you hold Caps down for less than 100ms and manage to press any Key before releasing Caps, it will carry out control+Key and type "No". You can vary the timing. This is the best I could do, perhaps there is a better way.

share|improve this answer
    
Very inventive. =) –  Malabarba Dec 25 '10 at 7:05
    
Thanks! If you ever find a better way, please let me know. –  Cerberus Dec 26 '10 at 2:52

I wrote a program in C++ that does this very thing. It remaps the Apps key rather than Capslocks, but it would be trivial to modify. The source code (and more info) is on github at https://github.com/russelldavis/KeyFix4000

share|improve this answer

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.