Advertisement
khongi

CapsLockModifier

Apr 16th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Use Caps Lock for Hand-Friendly Text Navigation
  3. http://lifehacker.com/5277383/use-caps-lock-for-hand+friendly-text-navigation
  4.  
  5. Written by Philipp Otto, Germany
  6.  
  7. Script Function:
  8. Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
  9.  
  10.     Normal usage with capslock as a modifier:
  11.     j: left
  12.     k: down
  13.     l: right
  14.     i: up
  15.     h: simulates CTRL+left (jumps to the next word)
  16.     ΓΆ: simulates CTRL+right (commented out, you will need to adjust for your keyboard layout)
  17.     ,: simulates CTRL+Down
  18.     8: simulates CTRL+Up
  19.     u: simulates "Home" (jumps to the beginning of the current line) (i forgot to mention this in my comment)
  20.     o: simulates "End"
  21.     Backspace: simulates "Delete"
  22.     b: cut
  23.     c: copy
  24.     v: paste
  25.  
  26.     If you keep pressing Alt in addition to Capslock it works as if you are pressing "Shift" β€”> you highlight the text. Shift + Capslock activates the actual Capslock functionality (normal capslock-hitting deactivates it again).
  27.  
  28. */
  29. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  30. ; #Warn  ; Enable warnings to assist with detecting common errors.
  31. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  32. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  33.  
  34. SetCapsLockState, AlwaysOff
  35.  
  36. CapsLock & i::
  37.        if getkeystate("alt") = 0
  38.                Send,{Up}
  39.        else
  40.                Send,+{Up}
  41. return
  42.  
  43. CapsLock & l::
  44.        if getkeystate("alt") = 0
  45.                Send,{Right}
  46.        else
  47.                Send,+{Right}
  48. return
  49.  
  50. CapsLock & j::
  51.        if getkeystate("alt") = 0
  52.                Send,{Left}
  53.        else
  54.                Send,+{Left}
  55. return
  56.  
  57. CapsLock & k::
  58.        if getkeystate("alt") = 0
  59.                Send,{Down}
  60.        else
  61.                Send,+{Down}
  62. return
  63.  
  64. CapsLock & ,::
  65.        if getkeystate("alt") = 0
  66.                Send,^{Down}
  67.        else
  68.                Send,+^{Down}
  69. return
  70.  
  71. CapsLock & 8::
  72.        if getkeystate("alt") = 0
  73.                Send,^{Up}
  74.        else
  75.                Send,+^{Up}
  76. return
  77.  
  78. CapsLock & u::
  79.        if getkeystate("alt") = 0
  80.                Send,{Home}
  81.        else
  82.                Send,+{Home}
  83. return
  84.  
  85. CapsLock & o::
  86.        if getkeystate("alt") = 0
  87.                Send,{End}
  88.        else
  89.                Send,+{End}
  90. return
  91.  
  92. CapsLock & H::
  93.        if getkeystate("alt") = 0
  94.                Send,^{Left}
  95.        else
  96.                Send,+^{Left}
  97. return
  98.  
  99. CapsLock & BS::Send,{Del}
  100. CapsLock & b::Send ^x
  101. CapsLock & n::Send ^c
  102. CapsLock & m::Send ^v
  103.  
  104. ;Prevents CapsState-Shifting
  105. CapsLock & Space::Send,{Space}
  106.  
  107. *Capslock::SetCapsLockState, AlwaysOff
  108. +Capslock::SetCapsLockState, On
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement