0%

AutoHotKey

Quick Reference

Quick Reference
Key List (Keyboard, Mouse, Joystick)

Script

Open & Toggle Applications

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
;Alt+c toggle Chrome
!c::
IfWinNotExist ahk_exe chrome.exe
{
Run "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
}
Else IfWinNotActive ahk_exe chrome.exe
{
WinActivate
}
Else
{
WinMinimize
}
Return

CapsLock Enhancement

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
;=====================================================================o
; Feng Ruohang's AHK Script |
; CapsLock Enhancement |
;---------------------------------------------------------------------o
;Description: |
; This Script is wrote by Feng Ruohang via AutoHotKey Script. It |
; Provieds an enhancement towards the "Useless Key" CapsLock, and |
; turns CapsLock into an useful function Key just like Ctrl and Alt |
; by combining CapsLock with almost all other keys in the keyboard. |
; |
;Summary: |
;o----------------------o---------------------------------------------o
;|CapsLock; | {ESC} Especially Convient for vim user |
;|CaspLock + ` | {CapsLock}CapsLock Switcher as a Substituent|
;|CapsLock + hjklwb | Vim-Style Cursor Mover |
;|CaspLock + uiop | Convient Home/End PageUp/PageDn |
;|CaspLock + nm,. | Convient Delete Controller |
;|CapsLock + zxcvay | Windows-Style Editor |
;|CapsLock + Direction | Mouse Move |
;|CapsLock + Enter | Mouse Click |
;|CaspLock + {F1}~{F6} | Media Volume Controller |
;|CapsLock + qs | Windows & Tags Control |
;|CapsLock + ;'[] | Convient Key Mapping |
;|CaspLock + dfert | Frequently Used Programs (Self Defined) |
;|CaspLock + 123456 | Dev-Hotkey for Visual Studio (Self Defined) |
;|CapsLock + 67890-= | Shifter as Shift |
;-----------------------o---------------------------------------------o
;|Use it whatever and wherever you like. Hope it help |
;=====================================================================o


;=====================================================================o
; CapsLock Initializer ;|
;---------------------------------------------------------------------o
SetCapsLockState, Alwaysoff ;|
;---------------------------------------------------------------------o

;=====================================================================o
; CapsLock Switcher: ;|
;---------------------------------o-----------------------------------o
; CapsLock + ` | {CapsLock} ;|
;---------------------------------o-----------------------------------o
CapsLock & `:: ;|
GetKeyState, CapsLockState, CapsLock, T ;|
if CapsLockState = D ;|
SetCapsLockState, AlwaysOff ;|
else ;|
SetCapsLockState, AlwaysOn ;|
KeyWait, `` ;|
return ;|
;---------------------------------------------------------------------o


;=====================================================================o
; CapsLock Escaper: ;|
;----------------------------------o----------------------------------o
; CapsLock | {ESC} ;|
;----------------------------------o----------------------------------o
CapsLock::Send, {ESC} ;|
;---------------------------------------------------------------------o


;=====================================================================o
; CapsLock Direction Navigator ;|
;-----------------------------------o---------------------------------o
; CapsLock + h | Left ;|
; CapsLock + j | Down ;|
; CapsLock + k | Up ;|
; CapsLock + l | Right ;|
; Ctrl, Alt Compatible ;|
;-----------------------------------o---------------------------------o
CapsLock & h:: ;|
if GetKeyState("control") = 0 ;|
{ ;|
if GetKeyState("alt") = 0 ;|
Send, {Left} ;|
else ;|
Send, +{Left} ;|
return ;|
} ;|
else { ;|
if GetKeyState("alt") = 0 ;|
Send, ^{Left} ;|
else ;|
Send, +^{Left} ;|
return ;|
} ;|
return ;|
;-----------------------------------o ;|
CapsLock & j:: ;|
if GetKeyState("control") = 0 ;|
{ ;|
if GetKeyState("alt") = 0 ;|
Send, {Down} ;|
else ;|
Send, +{Down} ;|
return ;|
} ;|
else { ;|
if GetKeyState("alt") = 0 ;|
Send, ^{Down} ;|
else ;|
Send, +^{Down} ;|
return ;|
} ;|
return ;|
;-----------------------------------o ;|
CapsLock & k:: ;|
if GetKeyState("control") = 0 ;|
{ ;|
if GetKeyState("alt") = 0 ;|
Send, {Up} ;|
else ;|
Send, +{Up} ;|
return ;|
} ;|
else { ;|
if GetKeyState("alt") = 0 ;|
Send, ^{Up} ;|
else ;|
Send, +^{Up} ;|
return ;|
} ;|
return ;|
;-----------------------------------o ;|
CapsLock & l:: ;|
if GetKeyState("control") = 0 ;|
{ ;|
if GetKeyState("alt") = 0 ;|
Send, {Right} ;|
else ;|
Send, +{Right} ;|
return ;|
} ;|
else { ;|
if GetKeyState("alt") = 0 ;|
Send, ^{Right} ;|
else ;|
Send, +^{Right} ;|
return ;|
} ;|
return ;|
;---------------------------------------------------------------------o


;=====================================================================o
; CapsLock Home/End Navigator ;|
;-----------------------------------o---------------------------------o
; CapsLock + i | Home ;|
; CapsLock + o | End ;|
; Ctrl, Alt Compatible ;|
;-----------------------------------o---------------------------------o
CapsLock & i:: ;|
if GetKeyState("control") = 0 ;|
{ ;|
if GetKeyState("alt") = 0 ;|
Send, {Home} ;|
else ;|
Send, +{Home} ;|
return ;|
} ;|
else { ;|
if GetKeyState("alt") = 0 ;|
Send, ^{Home} ;|
else ;|
Send, +^{Home} ;|
return ;|
} ;|
return ;|
;-----------------------------------o ;|
CapsLock & o:: ;|
if GetKeyState("control") = 0 ;|
{ ;|
if GetKeyState("alt") = 0 ;|
Send, {End} ;|
else ;|
Send, +{End} ;|
return ;|
} ;|
else { ;|
if GetKeyState("alt") = 0 ;|
Send, ^{End} ;|
else ;|
Send, +^{End} ;|
return ;|
} ;|
return
;top of file
CapsLock & g::
if GetKeyState("Shift") = 0
Send, ^{home}
Else
Send, ^{end}
Return
;|
;---------------------------------------------------------------------o


;=====================================================================o
; CapsLock Page Navigator ;|
;-----------------------------------o---------------------------------o
; CapsLock + u | PageUp ;|
; CapsLock + p | PageDown ;|
; Ctrl, Alt Compatible ;|
;-----------------------------------o---------------------------------o
CapsLock & u:: ;|
if GetKeyState("control") = 0 ;|
{ ;|
if GetKeyState("alt") = 0 ;|
Send, {PgUp} ;|
else ;|
Send, +{PgUp} ;|
return ;|
} ;|
else { ;|
if GetKeyState("alt") = 0 ;|
Send, ^{PgUp} ;|
else ;|
Send, +^{PgUp} ;|
return ;|
} ;|
return ;|
;-----------------------------------o ;|
CapsLock & p:: ;|
if GetKeyState("control") = 0 ;|
{ ;|
if GetKeyState("alt") = 0 ;|
Send, {PgDn} ;|
else ;|
Send, +{PgDn} ;|
return ;|
} ;|
else { ;|
if GetKeyState("alt") = 0 ;|
Send, ^{PgDn} ;|
else ;|
Send, +^{PgDn} ;|
return ;|
} ;|
return ;|
;---------------------------------------------------------------------o


;=====================================================================o
; CapsLock Mouse Controller ;|
;-----------------------------------o---------------------------------o
; CapsLock + Up | Mouse Up ;|
; CapsLock + Down | Mouse Down ;|
; CapsLock + Left | Mouse Left ;|
; CapsLock + Right | Mouse Right ;|
; CapsLock + Enter(Push Release) | Mouse Left Push(Release) ;|
;-----------------------------------o---------------------------------o
CapsLock & Up:: MouseMove, 0, -50, 0, R ;|
CapsLock & Down:: MouseMove, 0, 50, 0, R ;|
CapsLock & Left:: MouseMove, -50, 0, 0, R ;|
CapsLock & Right:: MouseMove, 50, 0, 0, R ;|
;-----------------------------------o ;|
CapsLock & Enter:: ;|
SendEvent {Blind}{LButton down} ;|
KeyWait Enter ;|
SendEvent {Blind}{LButton up} ;|
return ;|
;---------------------------------------------------------------------o


;=====================================================================o
; CapsLock Deletor ;|
;-----------------------------------o---------------------------------o
; CapsLock + n | Ctrl + Delete (Delete a Word) ;|
; CapsLock + m | Delete ;|
; CapsLock + , | BackSpace ;|
; CapsLock + . | Ctrl + BackSpace ;|
;-----------------------------------o---------------------------------o
CapsLock & ,:: Send, {Del} ;|
CapsLock & .:: Send, ^{Del} ;|
CapsLock & m:: Send, {BS} ;|
CapsLock & n:: Send, ^{BS}
;Delete to eol
CapsLock & d:: Send, +{end}{Del}
;Delete line
CapsLock & s:: Send, {home}+{end}{Del} ;|
;---------------------------------------------------------------------o


;=====================================================================o
; CapsLock Editor ;|
;-----------------------------------o---------------------------------o
; CapsLock + z | Ctrl + z (Cancel) ;|
; CapsLock + x | Ctrl + x (Cut) ;|
; CapsLock + c | Ctrl + c (Copy) ;|
; CapsLock + v | Ctrl + z (Paste) ;|
; CapsLock + a | Ctrl + a (Select All) ;|
; CapsLock + y | Ctrl + y (Yeild) ;|
; CapsLock + w | Ctrl + Right(Move as [vim: w]);|
; CapsLock + b | Ctrl + Left (Move as [vim: b]);|
;-----------------------------------o---------------------------------o
CapsLock & z:: Send, ^z ;|
CapsLock & x:: Send, ^x ;|
CapsLock & c:: Send, ^c ;|
CapsLock & v:: Send, ^v ;|
CapsLock & a:: Send, ^a ;|
CapsLock & y:: Send, ^y ;|
CapsLock & w:: Send, ^{Right} ;|
CapsLock & b:: Send, ^{Left} ;|
;---------------------------------------------------------------------o


;=====================================================================o
; CapsLock Media Controller ;|
;-----------------------------------o---------------------------------o
; CapsLock + F1 | Volume_Mute ;|
; CapsLock + F2 | Volume_Down ;|
; CapsLock + F3 | Volume_Up ;|
; CapsLock + F4 | Media_Play_Pause ;|
; CapsLock + F5 | Media_Prev ;|
; CapsLock + F6 | Media_Next ;|
; CapsLock + F7 | Media_Stop ;|
;-----------------------------------o---------------------------------o
CapsLock & F1:: Send, {Volume_Mute} ;|
CapsLock & F2:: Send, {Volume_Down} ;|
CapsLock & F3:: Send, {Volume_Up} ;|
CapsLock & F4:: Send, {Media_Play_Pause} ;|
CapsLock & F5:: Send, {Media_Prev} ;|
CapsLock & F6:: Send, {Media_Next}
CapsLock & F7:: Send, {Media_stop} ;|
;---------------------------------------------------------------------o


;=====================================================================o
; CapsLock Window Controller ;|
;-----------------------------------o---------------------------------o
; CapsLock + f | Ctrl + Tab (Swith Tag) ;|
; CapsLock + q | Ctrl + W (Close Tag) ;|
; Alt + CapsLock + s | Ctrl + Shift + Tab (Swith Tag);|
; Alt + CapsLock + q | Ctrl + Tab (Close Windows) ;|
; CapsLock + g | AppsKey (Menu Key) ;|
;-----------------------------------o---------------------------------o
CapsLock & f:: ;|
if GetKeyState("alt") = 0 ;|
{ ;|
Send, ^{Tab} ;|
} ;|
else { ;|
Send, ^+{Tab} ;|
return ;|
} ;|
return ;|
;-----------------------------------o ;|
CapsLock & q:: ;|
if GetKeyState("alt") = 0 ;|
{ ;|
Send, ^w ;|
} ;|
else { ;|
Send, !{F4} ;|
return ;|
} ;|
return ;|
;-----------------------------------o ;|
CapsLock & e:: Send, {AppsKey} ;|
;---------------------------------------------------------------------o

Reference
CapsLock魔改大法——变废为宝实现高效编辑