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.

Currently I am using following code for changing keyboard layout:

//vim.ahk
CapsLock::Send, {CTRLDOWN}{SHIFTDOWN}{SHIFTUP}{CTRLUP}{CTRLUP}
    return
!^CapsLock::CapsLock

CapsLock & j  :: Send  {Down}
CapsLock & k  :: Send {Up}
CapsLock & h  :: Send {Left}
CapsLock & l  :: Send {right}
CapsLock & p  :: Send {PGUP}
CapsLock & `; :: Send {PGDN}
CapsLock & ^  :: Send {home}
CapsLock & $  :: Send {end}

Is this code stable enough? The problem is that sometimes CapsLock undesirably turns on

Upadet: I found out that CapsLock turn on when it is press with any key except above keys. (hkll;pae)

share|improve this question
1  
I use something extremely similar. What type of answer are you looking for? Have you run into issues when using this code? –  Elliot DeNolf Nov 1 '12 at 12:35
    
I just want know is it in its optimal form or it can become better? –  PHPst Nov 1 '12 at 12:59
    
Note that j in Vim is down and k is up. –  echristopherson Nov 1 '12 at 21:53
    
@echristopherson Thanks, Corrected. –  PHPst Nov 2 '12 at 3:39
    
1. When does Capslock turn on? 2. What is you Capslock:: mapping for used for? –  William Bettridge-Radford Jan 14 '13 at 12:02

1 Answer 1

up vote 1 down vote accepted

add this to the top of your script.

SetCapsLockState, AlwaysOff

!^CapsLock::CapsLock

It should stop all Capslock events that you don't create.

http://www.autohotkey.com/docs/commands/SetNumScrollCapsLockState.htm

share|improve this answer
    
It was desirable that CapsLock could be turned on by using ctrl+shif+CapsLock, but I think keeping it always off is better than accidentally turning on. Thanks. –  PHPst Jan 15 '13 at 3:49
    
That should still work. –  William Bettridge-Radford Jan 15 '13 at 10:40
    
No, it does not work. –  PHPst Jan 16 '13 at 7:07
    
It's working for me here. Can you try it with just those two lines in their own file? Maybe try +Capslock:Capslock as well. –  William Bettridge-Radford Jan 16 '13 at 8:19
    
This does not work: SetCapsLockState, AlwaysOff !^CapsLock::CapsLock But this works: SetCapsLockState, AlwaysOff +Capslock::Capslock –  PHPst Jan 16 '13 at 8:57

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.