Feng Ruohang's AHK Script.ahk 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. ;=====================================================================o
  2. ; Feng Ruohang's AHK Script |
  3. ; CapsLock Enhancement |
  4. ;---------------------------------------------------------------------o
  5. ;Description: |
  6. ; This Script is wrote by Feng Ruohang via AutoHotKey Script. It |
  7. ; Provieds an enhancement towards the "Useless Key" CapsLock, and |
  8. ; turns CapsLock into an useful function Key just like Ctrl and Alt |
  9. ; by combining CapsLock with almost all other keys in the keyboard. |
  10. ; |
  11. ;Summary: |
  12. ;o----------------------o---------------------------------------------o
  13. ;|CapsLock; | {ESC} Especially Convient for vim user |
  14. ;|CaspLock + ` | {CapsLock}CapsLock Switcher as a Substituent|
  15. ;|CapsLock + hjklwb | Vim-Style Cursor Mover |
  16. ;|CaspLock + uiop | Convient Home/End PageUp/PageDn |
  17. ;|CaspLock + nm,. | Convient Delete Controller |
  18. ;|CapsLock + zxcvay | Windows-Style Editor |
  19. ;|CapsLock + Direction | Mouse Move |
  20. ;|CapsLock + Enter | Mouse Click |
  21. ;|CaspLock + {F1}~{F6} | Media Volume Controller |
  22. ;|CapsLock + qs | Windows & Tags Control |
  23. ;|CapsLock + ;'[] | Convient Key Mapping |
  24. ;|CaspLock + dfert | Frequently Used Programs (Self Defined) |
  25. ;|CaspLock + 123456 | Dev-Hotkey for Visual Studio (Self Defined) |
  26. ;|CapsLock + 67890-= | Shifter as Shift |
  27. ;-----------------------o---------------------------------------------o
  28. ;|Use it whatever and wherever you like. Hope it help |
  29. ;=====================================================================o
  30. ;=====================================================================o
  31. ; CapsLock Initializer ;|
  32. ;---------------------------------------------------------------------o
  33. SetCapsLockState, AlwaysOff ;|
  34. ;---------------------------------------------------------------------o
  35. ;=====================================================================o
  36. ; CapsLock Switcher: ;|
  37. ;---------------------------------o-----------------------------------o
  38. ; CapsLock + ` | {CapsLock} ;|
  39. ;---------------------------------o-----------------------------------o
  40. CapsLock & `:: ;|
  41. GetKeyState, CapsLockState, CapsLock, T ;|
  42. if CapsLockState = D ;|
  43. SetCapsLockState, AlwaysOff ;|
  44. else ;|
  45. SetCapsLockState, AlwaysOn ;|
  46. KeyWait, `` ;|
  47. return ;|
  48. ;---------------------------------------------------------------------o
  49. ;=====================================================================o
  50. ; CapsLock Escaper: ;|
  51. ;----------------------------------o----------------------------------o
  52. ; CapsLock | {ESC} ;|
  53. ;----------------------------------o----------------------------------o
  54. CapsLock::Send, {ESC} ;|
  55. ;---------------------------------------------------------------------o
  56. ;=====================================================================o
  57. ; CapsLock Direction Navigator ;|
  58. ;-----------------------------------o---------------------------------o
  59. ; CapsLock + h | Left ;|
  60. ; CapsLock + j | Down ;|
  61. ; CapsLock + k | Up ;|
  62. ; CapsLock + l | Right ;|
  63. ; Ctrl, Alt Compatible ;|
  64. ;-----------------------------------o---------------------------------o
  65. CapsLock & h:: ;|
  66. if GetKeyState("control") = 0 ;|
  67. { ;|
  68. if GetKeyState("alt") = 0 ;|
  69. Send, {Left} ;|
  70. else ;|
  71. Send, +{Left} ;|
  72. return ;|
  73. } ;|
  74. else { ;|
  75. if GetKeyState("alt") = 0 ;|
  76. Send, ^{Left} ;|
  77. else ;|
  78. Send, +^{Left} ;|
  79. return ;|
  80. } ;|
  81. return ;|
  82. ;-----------------------------------o ;|
  83. CapsLock & j:: ;|
  84. if GetKeyState("control") = 0 ;|
  85. { ;|
  86. if GetKeyState("alt") = 0 ;|
  87. Send, {Down} ;|
  88. else ;|
  89. Send, +{Down} ;|
  90. return ;|
  91. } ;|
  92. else { ;|
  93. if GetKeyState("alt") = 0 ;|
  94. Send, ^{Down} ;|
  95. else ;|
  96. Send, +^{Down} ;|
  97. return ;|
  98. } ;|
  99. return ;|
  100. ;-----------------------------------o ;|
  101. CapsLock & k:: ;|
  102. if GetKeyState("control") = 0 ;|
  103. { ;|
  104. if GetKeyState("alt") = 0 ;|
  105. Send, {Up} ;|
  106. else ;|
  107. Send, +{Up} ;|
  108. return ;|
  109. } ;|
  110. else { ;|
  111. if GetKeyState("alt") = 0 ;|
  112. Send, ^{Up} ;|
  113. else ;|
  114. Send, +^{Up} ;|
  115. return ;|
  116. } ;|
  117. return ;|
  118. ;-----------------------------------o ;|
  119. CapsLock & l:: ;|
  120. if GetKeyState("control") = 0 ;|
  121. { ;|
  122. if GetKeyState("alt") = 0 ;|
  123. Send, {Right} ;|
  124. else ;|
  125. Send, +{Right} ;|
  126. return ;|
  127. } ;|
  128. else { ;|
  129. if GetKeyState("alt") = 0 ;|
  130. Send, ^{Right} ;|
  131. else ;|
  132. Send, +^{Right} ;|
  133. return ;|
  134. } ;|
  135. return ;|
  136. ;---------------------------------------------------------------------o
  137. ;=====================================================================o
  138. ; CapsLock Home/End Navigator ;|
  139. ;-----------------------------------o---------------------------------o
  140. ; CapsLock + i | Home ;|
  141. ; CapsLock + o | End ;|
  142. ; Ctrl, Alt Compatible ;|
  143. ;-----------------------------------o---------------------------------o
  144. CapsLock & i:: ;|
  145. if GetKeyState("control") = 0 ;|
  146. { ;|
  147. if GetKeyState("alt") = 0 ;|
  148. Send, {Home} ;|
  149. else ;|
  150. Send, +{Home} ;|
  151. return ;|
  152. } ;|
  153. else { ;|
  154. if GetKeyState("alt") = 0 ;|
  155. Send, ^{Home} ;|
  156. else ;|
  157. Send, +^{Home} ;|
  158. return ;|
  159. } ;|
  160. return ;|
  161. ;-----------------------------------o ;|
  162. CapsLock & o:: ;|
  163. if GetKeyState("control") = 0 ;|
  164. { ;|
  165. if GetKeyState("alt") = 0 ;|
  166. Send, {End} ;|
  167. else ;|
  168. Send, +{End} ;|
  169. return ;|
  170. } ;|
  171. else { ;|
  172. if GetKeyState("alt") = 0 ;|
  173. Send, ^{End} ;|
  174. else ;|
  175. Send, +^{End} ;|
  176. return ;|
  177. } ;|
  178. return ;|
  179. ;---------------------------------------------------------------------o
  180. ;=====================================================================o
  181. ; CapsLock Page Navigator ;|
  182. ;-----------------------------------o---------------------------------o
  183. ; CapsLock + u | PageUp ;|
  184. ; CapsLock + p | PageDown ;|
  185. ; Ctrl, Alt Compatible ;|
  186. ;-----------------------------------o---------------------------------o
  187. CapsLock & u:: ;|
  188. if GetKeyState("control") = 0 ;|
  189. { ;|
  190. if GetKeyState("alt") = 0 ;|
  191. Send, {PgUp} ;|
  192. else ;|
  193. Send, +{PgUp} ;|
  194. return ;|
  195. } ;|
  196. else { ;|
  197. if GetKeyState("alt") = 0 ;|
  198. Send, ^{PgUp} ;|
  199. else ;|
  200. Send, +^{PgUp} ;|
  201. return ;|
  202. } ;|
  203. return ;|
  204. ;-----------------------------------o ;|
  205. CapsLock & p:: ;|
  206. if GetKeyState("control") = 0 ;|
  207. { ;|
  208. if GetKeyState("alt") = 0 ;|
  209. Send, {PgDn} ;|
  210. else ;|
  211. Send, +{PgDn} ;|
  212. return ;|
  213. } ;|
  214. else { ;|
  215. if GetKeyState("alt") = 0 ;|
  216. Send, ^{PgDn} ;|
  217. else ;|
  218. Send, +^{PgDn} ;|
  219. return ;|
  220. } ;|
  221. return ;|
  222. ;---------------------------------------------------------------------o
  223. ;=====================================================================o
  224. ; CapsLock Mouse Controller ;|
  225. ;-----------------------------------o---------------------------------o
  226. ; CapsLock + Up | Mouse Up ;|
  227. ; CapsLock + Down | Mouse Down ;|
  228. ; CapsLock + Left | Mouse Left ;|
  229. ; CapsLock + Right | Mouse Right ;|
  230. ; CapsLock + Enter(Push Release) | Mouse Left Push(Release) ;|
  231. ;-----------------------------------o---------------------------------o
  232. CapsLock & Up:: MouseMove, 0, -10, 0, R ;|
  233. CapsLock & Down:: MouseMove, 0, 10, 0, R ;|
  234. CapsLock & Left:: MouseMove, -10, 0, 0, R ;|
  235. CapsLock & Right:: MouseMove, 10, 0, 0, R ;|
  236. ;-----------------------------------o ;|
  237. CapsLock & Enter:: ;|
  238. SendEvent {Blind}{LButton down} ;|
  239. KeyWait Enter ;|
  240. SendEvent {Blind}{LButton up} ;|
  241. return ;|
  242. ;---------------------------------------------------------------------o
  243. ;=====================================================================o
  244. ; CapsLock Deletor ;|
  245. ;-----------------------------------o---------------------------------o
  246. ; CapsLock + n | Ctrl + Delete (Delete a Word) ;|
  247. ; CapsLock + m | Delete ;|
  248. ; CapsLock + , | BackSpace ;|
  249. ; CapsLock + . | Ctrl + BackSpace ;|
  250. ;-----------------------------------o---------------------------------o
  251. CapsLock & ,:: Send, {Del} ;|
  252. CapsLock & .:: Send, ^{Del} ;|
  253. CapsLock & m:: Send, {BS} ;|
  254. CapsLock & n:: Send, ^{BS} ;|
  255. ;---------------------------------------------------------------------o
  256. ;=====================================================================o
  257. ; CapsLock Editor ;|
  258. ;-----------------------------------o---------------------------------o
  259. ; CapsLock + z | Ctrl + z (Cancel) ;|
  260. ; CapsLock + x | Ctrl + x (Cut) ;|
  261. ; CapsLock + c | Ctrl + c (Copy) ;|
  262. ; CapsLock + v | Ctrl + z (Paste) ;|
  263. ; CapsLock + a | Ctrl + a (Select All) ;|
  264. ; CapsLock + y | Ctrl + z (Yeild) ;|
  265. ; CapsLock + w | Ctrl + Right(Move as [vim: w]);|
  266. ; CapsLock + b | Ctrl + Left (Move as [vim: b]);|
  267. ;-----------------------------------o---------------------------------o
  268. CapsLock & z:: Send, ^z ;|
  269. CapsLock & x:: Send, ^x ;|
  270. CapsLock & c:: Send, ^c ;|
  271. CapsLock & v:: Send, ^v ;|
  272. CapsLock & a:: Send, ^a ;|
  273. CapsLock & y:: Send, ^y ;|
  274. CapsLock & w:: Send, ^{Right} ;|
  275. CapsLock & b:: Send, ^{Left} ;|
  276. ;---------------------------------------------------------------------o
  277. ;=====================================================================o
  278. ; CapsLock Media Controller ;|
  279. ;-----------------------------------o---------------------------------o
  280. ; CapsLock + F1 | Volume_Mute ;|
  281. ; CapsLock + F2 | Volume_Down ;|
  282. ; CapsLock + F3 | Volume_Up ;|
  283. ; CapsLock + F3 | Media_Play_Pause ;|
  284. ; CapsLock + F5 | Media_Next ;|
  285. ; CapsLock + F6 | Media_Stop ;|
  286. ;-----------------------------------o---------------------------------o
  287. CapsLock & F1:: Send, {Volume_Mute} ;|
  288. CapsLock & F2:: Send, {Volume_Down} ;|
  289. CapsLock & F3:: Send, {Volume_Up} ;|
  290. CapsLock & F4:: Send, {Media_Play_Pause} ;|
  291. CapsLock & F5:: Send, {Media_Next} ;|
  292. CapsLock & F6:: Send, {Media_Stop} ;|
  293. ;---------------------------------------------------------------------o
  294. ;=====================================================================o
  295. ; CapsLock Window Controller ;|
  296. ;-----------------------------------o---------------------------------o
  297. ; CapsLock + s | Ctrl + Tab (Swith Tag) ;|
  298. ; CapsLock + q | Ctrl + W (Close Tag) ;|
  299. ; (Disabled) Alt + CapsLock + s | AltTab (Switch Windows) ;|
  300. ; Alt + CapsLock + q | Ctrl + Tab (Close Windows) ;|
  301. ; CapsLock + g | AppsKey (Menu Key) ;|
  302. ;-----------------------------------o---------------------------------o
  303. CapsLock & s::Send, ^{Tab} ;|
  304. ;-----------------------------------o ;|
  305. CapsLock & q:: ;|
  306. if GetKeyState("alt") = 0 ;|
  307. { ;|
  308. Send, ^w ;|
  309. } ;|
  310. else { ;|
  311. Send, !{F4} ;|
  312. return ;|
  313. } ;|
  314. return ;|
  315. ;-----------------------------------o ;|
  316. CapsLock & g:: Send, {AppsKey} ;|
  317. ;---------------------------------------------------------------------o
  318. ;=====================================================================o
  319. ; CapsLock Self Defined Area ;|
  320. ;-----------------------------------o---------------------------------o
  321. ; CapsLock + d | Alt + d(Dictionary) ;|
  322. ; CapsLock + f | Alt + f(Search via Everything);|
  323. ; CapsLock + e | Open Search Engine ;|
  324. ; CapsLock + r | Open Shell ;|
  325. ; CapsLock + t | Open Text Editor ;|
  326. ;-----------------------------------o---------------------------------o
  327. CapsLock & d:: Send, !d ;|
  328. CapsLock & f:: Send, !f ;|
  329. CapsLock & e:: Run http://cn.bing.com/ ;|
  330. CapsLock & r:: Run cmder ;|
  331. CapsLock & t:: Run C:\Program Files (x86)\Notepad++\notepad++.exe ;|
  332. ;---------------------------------------------------------------------o
  333. ;=====================================================================o
  334. ; CapsLock Char Mapping ;|
  335. ;-----------------------------------o---------------------------------o
  336. ; CapsLock + ; | Enter (Cancel) ;|
  337. ; CapsLock + ' | = ;|
  338. ; CapsLock + [ | Back (Visual Studio) ;|
  339. ; CapsLock + ] | Goto Define (Visual Studio) ;|
  340. ; CapsLock + / | Comment (Visual Studio) ;|
  341. ; CapsLock + \ | Uncomment (Visual Studio) ;|
  342. ; CapsLock + 1 | Build and Run(Visual Studio) ;|
  343. ; CapsLock + 2 | Debuging (Visual Studio) ;|
  344. ; CapsLock + 3 | Step Over (Visual Studio) ;|
  345. ; CapsLock + 4 | Step In (Visual Studio) ;|
  346. ; CapsLock + 5 | Stop Debuging(Visual Studio) ;|
  347. ; CapsLock + 6 | Shift + 6 ^ ;|
  348. ; CapsLock + 7 | Shift + 7 & ;|
  349. ; CapsLock + 8 | Shift + 8 * ;|
  350. ; CapsLock + 9 | Shift + 9 ( ;|
  351. ; CapsLock + 0 | Shift + 0 ) ;|
  352. ;-----------------------------------o---------------------------------o
  353. CapsLock & `;:: Send, {Enter} ;|
  354. CapsLock & ':: Send, = ;|
  355. CapsLock & [:: Send, ^- ;|
  356. CapsLock & ]:: Send, {F12} ;|
  357. ;-----------------------------------o ;|
  358. CapsLock & /:: ;|
  359. Send, ^e ;|
  360. Send, c ;|
  361. return ;|
  362. ;-----------------------------------o ;|
  363. CapsLock & \:: ;|
  364. Send, ^e ;|
  365. Send, u ;|
  366. return ;|
  367. ;-----------------------------------o ;|
  368. CapsLock & 1:: Send,^{F5} ;|
  369. CapsLock & 2:: Send,{F5} ;|
  370. CapsLock & 3:: Send,{F10} ;|
  371. CapsLock & 4:: Send,{F11} ;|
  372. CapsLock & 5:: Send,+{F5} ;|
  373. ;-----------------------------------o ;|
  374. CapsLock & 6:: Send,+6 ;|
  375. CapsLock & 7:: Send,+7 ;|
  376. CapsLock & 8:: Send,+8 ;|
  377. CapsLock & 9:: Send,+9 ;|
  378. CapsLock & 0:: Send,+0 ;|
  379. ;---------------------------------------------------------------------o