-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmacropad.ahk
More file actions
365 lines (308 loc) · 8.76 KB
/
Copy pathmacropad.ahk
File metadata and controls
365 lines (308 loc) · 8.76 KB
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
#NoEnv
#Warn
SendMode Input
SetWorkingDir %A_ScriptDir%
; App paths - update these specific to your files.
global DiscordPath := "C:\Users\username\AppData\Local\Discord\Update.exe"
global OperaPath := "C:\Users\username\AppData\Local\Programs\Opera GX\launcher.exe"
global SteamPath := "C:\Program Files (x86)\Steam\steam.exe"
global SpotifyPath := "C:\Users\username\AppData\Roaming\Spotify\Spotify.exe"
global VoiceMeeterPath := "C:\Program Files (x86)\VB\Voicemeeter\voicemeeter8x64.exe"
global MovieBoxProPath := "C:\Program Files\MovieBoxPro\MovieBoxPro\MovieBoxPro.exe"
ActivateOrLaunch(exeName, launchPath, extraArgs := "") {
IfWinExist, ahk_exe %exeName%
WinActivate
else {
if (extraArgs != "")
Run, %launchPath% %extraArgs%
else
Run, %launchPath%
}
}
global profile := 1
global profiles := {}
profiles[1] := "Audio"
profiles[2] := "Tasks"
profiles[3] := "Websites"
profiles[4] := "Hotswap"
profiles[5] := "Desktops"
global gameMode := false
global currentTooltip := ""
~ScrollLock::
SetNumLockState, AlwaysOn
ShowProfileTooltip()
return
#If (GetKeyState("ScrollLock", "T"))
NumpadAdd::
profile := % Mod(profile, 5) + 1
ShowProfileTooltip()
return
NumpadSub::
profile := % Mod(profile - 2 + 5, 5) + 1
ShowProfileTooltip()
return
; Audio profile
#If (GetKeyState("ScrollLock", "T") and profile = 1)
Numpad5::
send {Media_Play_Pause}
return
Numpad4::
if (IsBrowserActive()) {
Send, !{Left}
} else {
send {Media_Prev}
}
return
Numpad6::
if (IsBrowserActive()) {
Send, !{Right}
} else {
send {Media_Next}
}
return
Numpad8::
send {Volume_Up}
return
Numpad2::
send {Volume_Down}
return
Numpad0::
send {Volume_Mute}
return
Numpad1::
Send {LWin down}b{LWin up}
if (gameMode) {
gameMode := false
ShowTooltip("Game Mode: OFF")
}
return
Numpad3::
gameMode := !gameMode
ShowTooltip(gameMode ? "Game Mode: ON" : "Game Mode: OFF")
return
; Tasks profile - app launcher shortcuts
#If (GetKeyState("ScrollLock", "T") and profile = 2)
Numpad1::
ActivateOrLaunch("discord.exe", DiscordPath, "--processStart Discord.exe")
return
Numpad2::
ActivateOrLaunch("opera.exe", OperaPath)
return
Numpad3::
ActivateOrLaunch("steam.exe", SteamPath)
return
Numpad4::
ActivateOrLaunch("spotify.exe", SpotifyPath)
return
Numpad5::
Run, taskmgr
return
Numpad6::
Run, explorer
return
Numpad7::
ActivateOrLaunch("voicemeeter.exe", VoiceMeeterPath)
return
; Websites profile
#If (GetKeyState("ScrollLock", "T") and profile = 3)
Numpad1::
Run, https://www.youtube.com
return
Numpad2::
Run, https://www.google.com
return
Numpad3::
Run, https://www.9anime.pl
return
Numpad4::
Run, %MovieBoxProPath%
return
Numpad5::
Run, https://www.discord.com
return
Numpad6::
Run, https://www.github.com
return
Numpad7::
Run, https://www.twitch.tv
return
Numpad8::
Run, https://www.kick.com
return
Numpad0::
Run, https://chat.openai.com/
return
; Window movement between monitors
MoveActiveWindow(direction) {
WinGetActiveStats, winTitle, w, h, currentX, currentY
if (direction = "left") {
newX := currentX - A_ScreenWidth
newY := currentY
} else if (direction = "right") {
newX := currentX + A_ScreenWidth
newY := currentY
} else if (direction = "up") {
newX := currentX
newY := currentY - A_ScreenHeight
} else if (direction = "down") {
newX := currentX
newY := currentY + A_ScreenHeight
}
WinMove, %winTitle%,, %newX%, %newY%
}
; Hotswap profile - move windows around
#If (GetKeyState("ScrollLock", "T") and profile = 4)
Numpad4::
MoveActiveWindow("left")
return
Numpad6::
MoveActiveWindow("right")
return
Numpad8::
MoveActiveWindow("up")
return
Numpad2::
MoveActiveWindow("down")
return
; Desktops profile
#If (GetKeyState("ScrollLock", "T") and profile = 5)
Numpad1::
Send {LWin down}{Ctrl down}{Shift down}{Left down}
Send {LWin up}{Ctrl up}{Shift up}{Left up}
return
Numpad3::
Send {LWin down}{Ctrl down}{Shift down}{Right down}
Send {LWin up}{Ctrl up}{Shift up}{Right up}
return
Numpad4::
Send {LWin down}{Ctrl down}{Left down}
Send {LWin up}{Ctrl up}{Left up}
return
Numpad6::
Send {LWin down}{Ctrl down}{Right down}
Send {LWin up}{Ctrl up}{Right up}
return
Numpad8::
Send {LWin down}{Ctrl down}d{LWin up}{Ctrl up}
return
Numpad2::
Send {LWin down}{Ctrl down}{F4 down}
Send {LWin up}{Ctrl up}{F4 up}
return
Numpad5::
Send {LWin down}{Tab down}
Send {LWin up}{Tab up}
return
#If
; Game Mode persistent hotkey
XButton2:: ; Mouse5
if (gameMode) {
Send {LWin down}{Ctrl down}{Alt down}{p down}
KeyWait, XButton2
Send {LWin up}{Ctrl up}{Alt up}{p up}
} else {
Send {XButton2}
}
return
#If (profile = 1) ; Audio profile
; Audio profile hotkeys
#If (profile = 2) ; Tasks profile
; Tasks profile hotkeys
#If (profile = 3) ; Websites profile
; Websites profile hotkeys
#If (profile = 4) ; Hotswap profile
; Hotswap profile hotkeys
#If
; Update the ShowTooltip function to position the tooltip above the mouse cursor
ShowTooltip(message, duration := 1000) {
global currentTooltip
currentTooltip := message
SetTimer, UpdateTooltipPosition, 10 ; Update position every 10ms
SetTimer, HideTooltip, -%duration%
}
UpdateTooltipPosition:
if (currentTooltip != "") {
CoordMode, Mouse, Screen
CoordMode, ToolTip, Screen
MouseGetPos, mouseX, mouseY
tooltipX := mouseX + 20 ; Position tooltip 20 pixels to the right of the mouse cursor
ToolTip, %currentTooltip%, tooltipX, mouseY
}
return
HideTooltip:
ToolTip
currentTooltip := ""
SetTimer, UpdateTooltipPosition, Off
return
ShowProfileTooltip() {
global profile, profiles
ShowTooltip("Current Profile: " . profiles[profile], 1500)
}
IsBrowserActive() {
WinGetActiveTitle, activeWindow
return (InStr(activeWindow, "Opera")
or InStr(activeWindow, "Chrome")
or InStr(activeWindow, "Edge")
or InStr(activeWindow, "Firefox")
or InStr(activeWindow, "Brave"))
}
; Help Hotkey
F1::
helpText := "Current Profile: " . profiles[profile] . "`n`n"
helpText .= "F1: Show this help`n"
helpText .= "ScrollLock: Toggle Numpad override`n"
helpText .= "NumpadAdd/Sub: Change profile`n`n"
if (profile = 1) {
helpText .= "Audio Profile Hotkeys:`n"
helpText .= "Numpad5: Play/Pause`n"
helpText .= "Numpad4/6: Previous/Next (or Browser Back/Forward)`n"
helpText .= "Numpad8/2: Volume Up/Down`n"
helpText .= "Numpad0: Mute`n"
helpText .= "Numpad1: Windows+B (Disable Game Mode if active)`n"
helpText .= "Numpad3: Toggle Game Mode`n"
} else if (profile = 2) {
helpText .= "Tasks Profile Hotkeys:`n"
helpText .= "Numpad1: Discord`n"
helpText .= "Numpad2: Opera`n"
helpText .= "Numpad3: Steam`n"
helpText .= "Numpad4: Spotify`n"
helpText .= "Numpad5: Task Manager`n"
helpText .= "Numpad6: File Explorer`n"
helpText .= "Numpad7: VoiceMeeter`n"
} else if (profile = 3) {
helpText .= "Websites Profile Hotkeys:`n"
helpText .= "Numpad1: YouTube`n"+-+-
helpText .= "Numpad2: Google`n"
helpText .= "Numpad3: 9anime`n"
helpText .= "Numpad4: MovieBoxPro`n"
helpText .= "Numpad5: Discord`n"
helpText .= "Numpad6: GitHub`n"
helpText .= "Numpad7: Twitch`n"
helpText .= "Numpad8: Kick`n"
helpText .= "Numpad0: ChatGPT`n"
} else if (profile = 4) {
helpText .= "Hotswap Profile Hotkeys:`n"
helpText .= "Numpad4: Move window left`n"
helpText .= "Numpad6: Move window right`n"
helpText .= "Numpad8: Move window up`n"
helpText .= "Numpad2: Move window down`n"
} else if (profile = 5) {
helpText .= "Desktops Profile Hotkeys:`n"
helpText .= "Numpad1: Move window to previous desktop (Ctrl+Win+Shift+Left)`n"
helpText .= "Numpad3: Move window to next desktop (Ctrl+Win+Shift+Right)`n"
helpText .= "Numpad4: Switch to left desktop (Ctrl+Win+Left)`n"
helpText .= "Numpad6: Switch to right desktop (Ctrl+Win+Right)`n"
helpText .= "Numpad8: Create new desktop (Ctrl+Win+D)`n"
helpText .= "Numpad2: Close current desktop (Ctrl+Win+F4)`n"
helpText .= "Numpad5: View all desktops (Win+Tab)`n"
}
MsgBox, %helpText%
return
; Suspend Hotkey
^!s:: ; Ctrl+Alt+S to suspend/resume the script
Suspend
if A_IsSuspended
ShowTooltip("Script Suspended")
else
ShowTooltip("Script Resumed")
return