-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAutoHotkey.ahk
executable file
·368 lines (293 loc) · 12.6 KB
/
AutoHotkey.ahk
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
362
363
364
365
366
367
368
; ==========================================================================================
; Autorun part
; ==========================================================================================
; Matchwindow titles by regex
SetTitleMatchMode(2)
SetTitleMatchMode("slow")
SetControlDelay(-1)
; Send Alt+F4 upon Ctrl+W in those applications:
GroupAdd("CloseWithCtrlW", "Greenshot")
GroupAdd("CloseWithCtrlW", "ahk_exe cmd.exe")
GroupAdd("CloseWithCtrlW", "ahk_exe explorer.exe")
GroupAdd("CloseWithCtrlW", "ahk_exe i_view64.exe") ; IrfanView
GroupAdd("CloseWithCtrlW", "ahk_exe notepad.exe") ; notepad
GroupAdd("CloseWithCtrlW", "ahk_exe regedit.exe") ; regedit
GroupAdd("CloseWithCtrlW", "ahk_exe taskmgr.exe") ; TaskManager
GroupAdd("CloseWithCtrlW", "ahk_exe WinMergeU.exe") ; WinMerge
GroupAdd("CloseWithCtrlW", "ahk_class FM") ; 7zip
GroupAdd("CloseWithCtrlW", "ahk_class TfcSearchForm") ; FreeCommander search form
; Send special characters for writing
GroupAdd("WritingWithScissoirs", "ahk_exe Discord.exe")
GroupAdd("WritingWithScissoirs", "ahk_exe Evernote.exe")
GroupAdd("WritingWithScissoirs", "Google")
GroupAdd("WritingWithScissoirs", "Word")
GroupAdd("WritingWithScissoirs_Ignore", "ahk_exe sublime_text.exe")
SetWorkingDir A_ScriptDir
GroupAdd("EditAhkFile", "Notepad++")
GroupAdd("EditAhkFile", "ahk_class Notepad")
GroupAdd("FreeCommander", "ahk_exe FreeCommander.exe")
GroupAdd("Outlook", "ahk_exe OUTLOOK.EXE")
DetectHiddenWindows(true)
; automatically overwrite this script upon launching
#SingleInstance force
Persistent
; PleasantNotify("AutoHotkey reloaded", "" , 330, 80, "b r", "2")
#Include "AutoHotkey\RunOrSwitchTo.ahk"
; #Include %A_ScriptDir%\AutoHotkey\PleasantNotify.ahk
; #Include %A_ScriptDir%\AutoHotkey\Notepad++.ahk
; #Include %A_ScriptDir%\AutoHotkey\OpenSettingsWithCtrlComma.ahk
#Include %A_ScriptDir%\AutoHotkey\GamingFunctions.ahk
#Include "AutoHotkey\Photoshop.ahk"
; #Include %A_ScriptDir%\AutoHotkey\ClickBackgroundWindow.ahk
; #Include %A_ScriptDir%\AutoHotkey\EldenRing.ahk
; #Include %A_ScriptDir%\AutoHotkey\chrome.ahk
; ------------------------------------------------------------------------------------------
; Disable insert, keep num lock and caps lock state
; ------------------------------------------------------------------------------------------
Capslock::<
+Capslock::>
+Numpad0::Delete
SetNumLockState("AlwaysOn")
SetCapsLockState("AlwaysOff")
#SC01B::return ; disable screen magnifier because I hate it
!Shift::return ; disable input lang switch because I hate it
#Shift::return ; disable input lang switch because I hate it
~LAlt Up::return ; don't go to window menu thingy with alt
SendMode("Input") ; Recommended for new scripts due to its superior speed and reliability
GroupAdd("WritingWithScissoirs", "ahk_exe Discord.exe")
GroupAdd("WritingWithScissoirs", "ahk_exe Evernote.exe")
GroupAdd("WritingWithScissoirs", "Google")
GroupAdd("WritingWithScissoirs", "Firefox")
GroupAdd("WritingWithScissoirs", "Word")
WritingWithScissors(*)
{
if WinActive("ahk_class Notepad++")
return false
if WinActive("ahk_class Notepad")
return true
if WinActive("ahk_exe Discord.exe")
return true
if WinActive("ahk_exe Evernote.exe")
return true
if WinActive("Google")
return true
if WinActive("Word")
return true
return false
}
!SC035:: Send("{U+2014}")
; ==========================================================================================
; Autorun part end
return
; ==========================================================================================
#HotIf WinActive("ahk_group WritingWithScissors")
!SC035:: Send("{U+2014}")
:*?:--::—
; !SC035 :: Send("{U+2014}") ;— - this does work
; !.:: Send("…")
; ; :*?:--::—
; :*?:...::…
; !^a:: Send("{U+0100}") ;Ā
; !a:: Send("{U+0101}") ;ā
;
; !^o:: Send("{U+14c}") ;Ō
; !o:: Send("{U+14d}") ;ō
;
; !+u:: Send("{U+16a}") ;Ū
; !u:: Send("{U+16b}") ;Ū
;
; ; !.::Send, {U+2026} ;…
;
; ^+1:: Send("¡")
; ^+ß:: Send("¿")
#HotIf
; ------------------------------------------------------------------------------------------
; Windows-H will minimize, Windows-M will maximize current window
; ------------------------------------------------------------------------------------------
#HotIf !WinActive("ahk_exe cheatengine-x86_64.exe",)
#m::MinMax()
#h::WinMinimize("A")
#HotIf !WinActive(, )
#HotIf !WinActive("ahk_exe eclipse.exe", )
#h:: WinMinimize("A")
#HotIf !WinActive(, )
#HotIf WinActive("ahk_exe blender.exe",)
^+!s::Send("{f20}")
#HotIf
#HotIf !WinActive("ahk_class Notepad++",)
; Japanese letters
!^Numpad1::Send("{U+0100}") ;Ā
!Numpad1::Send("{U+0101}") ;ā
!^Numpad2::Send("{U+14c}") ;Ō
!Numpad2::Send("{U+14d}") ;ō
!^Numpad3::Send("{U+16a}") ;Ū
!Numpad3::Send("{U+16b}") ;ū
#HotIf
; ------------------------------------------------------------------------------------------
; --------------------- ! is alt ^ is ctrl # is windows + is shift ------------------------
; ------------------------------------------------------------------------------------------
MinMax()
{
WinState := WinGetMinMax("A")
if (WinState = 0) {
WinMaximize("A")
return
}
WinRestore("A")
}
#HotIf WinActive("ahk_exe explorer.exe", )
!d:: Send("{f4}")
^l::!d
#HotIf
#HotIf WinActive("ahk_exe Photoshop.exe", )
^+y:: Send("^+{i}")
#HotIf
; #d::SetDefaultKeyboard(0x407)
; ------------------------------------------------------------------------------------------
; windows+key opens program
; requires RunOrSwitchTo.ahk to be loaded
; ------------------------------------------------------------------------------------------
#n::RunOrSwitchTo("C:\Program Files (x86)\Notepad++\notepad++.exe", "Notepad++") ; win+n notepad++
#+n::RunOrSwitchTo("C:\Program Files (x86)\Evernote\Evernote\Evernote.exe") ; , "ahk.exe Evernote.exe") ; win+n notepad++
#c::RunOrSwitchTo("C:\01_apps\cmder\Cmder.exe", "ahk_exe ConEmu64.exe") ; win+c console
; #f::RunOrSwitchTo("C:\Program Files\Google\Chrome\Application\chrome.exe", "Google Chrome") ; win+f firefox
#f::RunOrSwitchTo("C:\Program Files\Firefox Developer Edition\firefox.exe", "Firefox Developer Edition") ; win+f firefox
#+x::RunOrSwitchTo("%programfiles%\Microsoft Office\Office16\EXCEL.exe") ; win+shift+x excel
#e::RunOrSwitchTo("C:\Program Files\FreeCommander XE\FreeCommander.exe", "FreeCommander")
; #+e::RunOrSwitchTo("E:\Program Files\Microsoft VS Code\Code.exe", "ahk_exe Code.exe")
; #^e::RunOrSwitchTo("E:\Program Files\Noesis\Noesis.exe", "ahk_exe Noesis.exe")
; #+f::RunOrSwitchTo("D:\Games\Frosty\00_modmanager\FrostyModManager.exe", "ahk_exe FrostyModManager.exe")
; #+^p::RunOrSwitchTo("C:\Program Files\Adobe\Adobe Photoshop 2021\Photoshop.exe", "ahk_exe Photoshop.exe")
#+m::RunOrSwitchTo("C:\Users\mana\AppData\Local\GPMDP_3\Update.exe", "ahk_exe Google Play Music Desktop Player.exe")
#s::RunOrSwitchTo("C:\Program Files\Sublime Text\sublime_text.exe", "ahk_exe sublime_text.exe")
#HotIf !WinActive("ahk_exe blender.exe", )
; #g:: ;win+g disable game bar, do nothing
#HotIf !WinActive(, )
#HotIf WinActive("ahk_exe blender.exe", )
+!^s:: {
KeyWait("Control") ; Wait for both Control and Alt to be released.
KeyWait("Alt")
KeyWait("Shift")
Send("{ f20 }")
}
#HotIf
#HotIf WinActive("ahk_exe Evernote.exe", )
^!v:: Send("${^+{v}]")
#HotIf
; ------------------------------------------------------------------------------------------
; alt-shift-d opens download folder
; opens explorer on c drive
; ------------------------------------------------------------------------------------------
; !+d::Run, explore "%USERPROFILE%\Downloads"
; #+g::Run, explore "%USERPROFILE%\git"
; ------------------------------------------------------------------------------------------
; close with ctrl-w
; ------------------------------------------------------------------------------------------
#HotIf WinActive("ahk_group CloseWithCtrlW", )
^w::Send("!{F4}")
#HotIf
#HotIf WinActive("ahk_exe cmd.exe", )
esc::Send("!{F4}")
#HotIf
; Same hotkeys in VisualMerge and WinMerge
#HotIf WinActive("Visual Merge", )
!Down::F8
!Up::F7
#HotIf
#HotIf WinActive("ahk_exe WinMergeU.exe", )
!^+Right::ControlClick("x528 y10", "A", , "M")
!^+Left:: ControlClick("x528 y14", "A", , "M")
+Tab::F6
#HotIf
; ------------------------------------------------------------------------------------------
; Send a sequence of key presses. Call like SendWithSleeps( "h-Down-Down-Down-Enter" )
; ------------------------------------------------------------------------------------------
SendWithSleeps( string, delay:=100 ) {
pos := 0
Loop Parse, string, "`"-`""
{
Send("{ " StrReplace(A_LoopField, "minus", "-") " }")
Sleep(delay)
}
}
; ------------------------------------------------------------------------------------------
; reload with ctrl+(alt/shift)+(y/r) in notepad and notepad++
; ------------------------------------------------------------------------------------------
#HotIf WinActive("ahk_group EditAhkFile", )
; ------------------------------------------------------------------------------------------
ReloadThis()
{
Reload()
Sleep(1000) ; If successful, the reload will close this instance during the Sleep, so the line below will never be reached.
msgResult := MsgBox("The script could not be reloaded. Would you like to open it for editing?", "", 2)
if (msgResult = "Yes")
Edit()
return
}
^!r::ReloadThis()
^+r::ReloadThis()
#HotIf
+f12::ReloadThis()
; ------------------------------------------------------------------------------------------
; enable extra mouse buttons in 7zip
; ------------------------------------------------------------------------------------------
#HotIf WinActive("ahk_class FM", )
XButton1::Backspace
XButton2::Enter
#HotIf
; ------------------------------------------------------------------------------------------
; winmerge: replace with ctrl+r
; ------------------------------------------------------------------------------------------
#HotIf WinActive("ahk_exe WinMergeU.exe", )
^r::^h
#HotIf
; ------------------------------------------------------------------------------------------
; Firefox
; ------------------------------------------------------------------------------------------
#HotIf WinActive("ahk_exe firefox.exe", )
^y::^+h
#HotIf
; ------------------------------------------------------------------------------------------
; OneNote
; ------------------------------------------------------------------------------------------
#HotIf WinActive("ahk_exe ONENOTE.EXE", )
^+f:: Send("^{ e }")
#HotIf
; ------------------------------------------------------------------------------------------
; Notepad++
; ------------------------------------------------------------------------------------------
#HotIf WinActive("ahk_exe notepad++.exe", )
^d:: Send("^+{ d }")
^+h:: Send("^+{ f }")
#HotIf
; ------------------------------------------------------------------------------------------
; Explorer
; ------------------------------------------------------------------------------------------
#HotIf WinActive("ahk_exe explorer.exe", )
!g::{
}
#HotIf
; ------------------------------------------------------------------------------------------
; Google Sheets
; ------------------------------------------------------------------------------------------
#HotIf WinActive("Google Sheets", )
!m::{
CoordMode "Mouse", "Window"
MouseGetPos &xpos, &ypos
MouseMove 373, 1315
Click
Send("{Down}")
Send("{Down}")
Send("{Down}")
Send("{Down}")
Send("{Down}")
Send("{Down}")
Send("{Down}")
Send("{Down}")
Send("{Right}")
Send("{Down}")
Send("{Down}")
Send("{NumpadEnter}")
MouseMove(xpos, ypos)
}
#HotIf