-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNumpad_LEGACY.ahk
105 lines (91 loc) · 2.3 KB
/
Numpad_LEGACY.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
#Requires AutoHotkey v2.0
;----------------------------------------------------------------------------------
;Change these values:
global microphone := "Microphone (microphone)" ;Name of default microphone device.
global app := "Spotify" ;App to change volume of.
;----------------------------------------------------------------------------------
global svv := "./SoundVolumeView/SoundVolumeView.exe"
global mutedico := "./Icons/mute.ico"
global unmutedico := "./Icons/default.ico"
global minimized := false
global MyGui := false
Notification(text, timeout, width := 100) {
if (MyGui) {
MyGui.Destroy()
}
sleep 0.5
global MyGui := Gui()
sleep 0.5
MyGui.Opt("+AlwaysOnTop -Caption +ToolWindow")
MyGui.BackColor := "000000"
MyGui.SetFont("s20")
MyGui.Add("Text", ("cffffff Center " width " h35"), text)
MyGui.Opt("Border")
WinSetTransColor(" 175", MyGui)
MyGui.Show("x864 y971 NoActivate")
SetTimer () => MyGui.Destroy(), timeout
}
ChangeVolume(app, change, timeout) {
RunWait(svv " /ChangeVolume " app " " change)
vol := RegExReplace(RunWait(svv " /Stdout /GetPercent " app), "(?(?<=.)0|)$")
Notification(app " Vol: " vol "%", timeout, 215)
}
*NumpadHome::<#Tab
*NumpadEnd::DllCall("LockWorkStation")
*NumpadLeft::Media_Prev
*NumpadIns::Media_Play_Pause
*NumpadRight::Media_Next
*NumpadUp::Volume_Up
*NumpadClear::Volume_Mute
*NumpadDown::Volume_Down
*NumpadPgUp::{
if (GetKeyState("Control")) {
change := "+1"
} else if (GetKeyState("Shift")) {
change := "+10"
} else {
change := "+5"
}
ChangeVolume(app, change, 2000)
}
*NumpadPgDn::{
if (minimized) {
global minimized := false
} else if (!minimized) {
if (GetKeyState("Control")) {
change := "-1"
} else if (GetKeyState("Shift")) {
change := "-10"
} else {
change := "-5"
}
ChangeVolume(app, change, 2000)
}
}
*NumpadEnter::{
;Send("{Media_Stop}")
WinMinimizeAll
global minimized := true
Loop {
Sleep 10
if (!GetKeyState("NumpadEnter", "P")) {
break
} else if (!minimized) {
return
}
}
WinMinimizeAllUndo
global minimized := false
}
*NumpadDel::{
SoundSetMute(-1,, microphone)
if (SoundGetMute(, microphone)) {
TraySetIcon(mutedico,, true)
Notification("Mic Muted", 2000, 172)
SoundPlay("*64")
} else {
TraySetIcon(unmutedico,, false)
Notification("Mic Unmuted", 2000, 172)
SoundPlay("*64")
}
}