toggle 3 audio devices
Posted: 11 Oct 2018, 16:16
Hello!
First post...
Found this forum when looking for something to switch between audio devices using keyboard.
Saw this script that works perfectly but I can't for the life of me figure out how to add a third device?
If anyone could guide me it would be much appreciated.
Using Win 7 x64
AutoHotkey 1.1.30.00
NirCmd v2.81
Best regards
The script looks like this:
First post...
Found this forum when looking for something to switch between audio devices using keyboard.
Saw this script that works perfectly but I can't for the life of me figure out how to add a third device?
If anyone could guide me it would be much appreciated.
Using Win 7 x64
AutoHotkey 1.1.30.00
NirCmd v2.81
Best regards
The script looks like this:
Code: Select all
#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 "Headphones"
soundToggleBox("Headphones")
}
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