-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchange_playback_device.ahk
43 lines (38 loc) · 998 Bytes
/
change_playback_device.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
#Persistent ; This keeps the script running permanently.
#SingleInstance ; Only allows one instance of the script to run.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Win+A to change Audio Playback Device
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#a::
toggle:=!toggle ; This toggles the variable between true/false
if toggle
{
Run nircmd setdefaultsounddevice "Speakers"
soundToggleBox("Speakers")
}
else
{
Run nircmd setdefaultsounddevice "Headset"
soundToggleBox("Headset")
}
Return
; Display sound toggle GUI
soundToggleBox(Device)
{
IfWinExist, soundToggleWin
{
Gui, destroy
}
Gui, +ToolWindow -Caption +0x400000 +alwaysontop
Gui, Add, text, x35 y8, Default sound: %Device%
SysGet, screenx, 0
SysGet, screeny, 1
xpos:=screenx-275
ypos:=screeny-100
Gui, Show, NoActivate x%xpos% y%ypos% h30 w200, soundToggleWin
SetTimer,soundToggleClose, 2000
}
soundToggleClose:
SetTimer,soundToggleClose, off
Gui, destroy
Return