ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

DONE: A shortcut/hotkey to switch between audio devices?

<< < (9/9)

wr975:
Then please post the full code here for others to easily see it
--- End quote ---

Here's the working AHK script. Four people wrote on it, thanks to everyone involved!  :Thmbsup:


--- ---
SetTitleMatchMode, Slow

Run, RunDll32.exe shell32.dll`,Control_RunDLL mmsys.cpl`,`,2
WinWait,ahk_class #32770

IfWinActive, ahk_class #32770,RealTek AC97 Audio
     send, {alt down}d{alt up}s{enter}
else
     send, {alt down}d{alt up}r{enter}

DesertEagle:
Take a look at Audio Sliders (http://www.codesector.com/mixer.asp), it can change default playback and recording devices with single click on its tray icon.

zYx:
Hi,

how do I do it in windows vista?

Cheers

Ryan_S:
I thought I'd add a script here for changing the device in Vista. I needed this for my XPS1530 for switching between the HDMI output and the speakers.

I had to write it in AutoIT because AutoHotKey doesn't support working with the SysListView directly, and I'm not a huge fan of sending keystrokes. I also couldn't find the registry keys in Vista. Seems MS has moved those.


--- Code: AutoIt ---Run("c:\windows\system32\control.exe mmsys.cpl") WinWaitActive("Sound") ControlListView("Sound", "", "SysListView321", "Select", 0) ;Select the first device in the list$result = ControlCommand("Sound", "", "Button2", "IsEnabled", "") ;checks if Set As Default button is enabledIf $result Then        ;if Set As Default is enabled we can enable this device        ControlClick("Sound",  "", "Button2") ;Click Set As Default        ControlClick("Sound", "", "Button4") ;Click OK        Traytip("Audio Out", "Speakers / Headphones selected", 5, 1)        Sleep(5000)        ExitEndIf ControlListView("Sound", "", "SysListView321", "Select", 1) ;select the second device in the list$result = ControlCommand("Sound", "", "Button2", "IsEnabled", "") ;checks if Set As Default button is enabledIf $result Then        ;if Set As Default is enabled we can enable this device        ControlClick("Sound",  "", "Button2") ;Click Set As Default        ControlClick("Sound", "", "Button4") ;Click OK        Traytip("Audio Out", "HDMI selected", 5, 1)        Sleep(5000)        ExitEndIf

Navigation

[0] Message Index

[*] Previous page

Go to full version