3
votes

I've been using autoHotKeyrecently on a windows 8 machine and loving it. But I want to be able to press caps lock and turn the keyboard into a vim like command mode for moving the cursor, inserting and deleting easily in any program.

UPDATE (Thanks to @MCL for the help so far)

Im trying to use the following script but it wont change the behaviour based on the state

state := GetKeyState("Capslock", "T") 
if state
  j::Send,{Left}
  l::Send,{Right}
  i::Send,{Up}
  k::Send,{Down}
return
1
Cool story, bro. Is there a question somewhere? Something you've tried? Any precise problem you ran into?MCL
Sorry, yes the problem is that i cant get AHK to change key functionality based on the presence of capslock being on. i can detect that capslock is currently being pressed but not that it is on or off.Damo
Since you didn't provide any code, I can only guess that you're not using toggle mode. Read about it here.MCL

1 Answers

6
votes

Create context-sensitive hotkeys with #If:

#If GetKeyState("CapsLock", "T")=1

; The following hotkeys will only be effective if GetKeyState("CapsLock", "T")=1
j::Send,{Left}
l::Send,{Right}
i::Send,{Up}
k::Send,{Down}

#If ; end of #If