Need shortcut to change audio device in one click

  • Question
  • Updated 6 months ago
Would like a Quick Launch icon to take me directly to the AUDIO TAB of the Sound and Audio Device Properties applet or other option to let me change my output device without having the extra step(s) of first having to open the applet then navigating to the audio tab where I can make my selection.
Again, all I'm trying to do is get a shortcut on my desktop to change audio device with one click, is this even possible?
Thanks,
JD
Photo of Justo F. Damian

Justo F. Damian

  • 3 Posts
  • 2 Reply Likes

Posted 7 years ago

  • 7
Photo of

  • 3 Posts
  • 2 Reply Likes
you can do something like so, but its not a complete solution, I want to do the same thing:

-Open the Control Panel
-Right click Sounds and Audio Devices
-Select Create Shortcut
-Click YES to the prompt
-A shortcut will be created on your Desktop
Photo of

  • 3 Posts
  • 2 Reply Likes
also found this: you can create a BAT file to open right to the location you need:

open notepad
type the following:

@echo off
RunDll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,2
exit

save as "anything you want".bat.

this will open the command line, then run mmsys.cpl which is literally the sound and audio devices program, then open the audio tab, so you only have to change which audio device you want to make primary...

still more searching to get what we both want though.
Photo of WuShu101

WuShu101

  • 1 Post
  • 0 Reply Likes
I Love you, for this answer I have been messing with macros and programs and madness for days you have saved my Eternal torture on this subject. thank you ever so much "::::)))))))))))))))))))))))))
Photo of

  • 3 Posts
  • 2 Reply Likes
ok, after some research, props goes to this forum: http://www.donationcoder.com/Forums/b...

short and easy:

download and install small tool: http://www.autohotkey.com/

Now the simple way is create two files name them whatever you want whatever-device1.ahk and whatever-device2.ahk

for whatever-device1.ahk just open up notepad, past the below code into the file, and save it as whatever-devcice1.ahk (you can name it whatever you prefer):

code:
------- (dont include these lines i have to the left of this)

Run, RunDll32.exe shell32.dll`,Control_RunDLL mmsys.cpl`,`,2
WinWait,ahk_class #32770
send, {alt down}d{alt up}b{enter}

where you have the LAST letter "b" above (to the left of {enter} ) put the first letter of YOUR COMPUTERS audio device name, in my case its called "Bluetooth Wave" so i use the letter b.

Now to set it back to the default audio file, in my case its called "conexant audio", I created the second script

whatever-device2.ahk

code:
------- (dont include these lines i have to the left of this)

Run, RunDll32.exe shell32.dll`,Control_RunDLL mmsys.cpl`,`,2
WinWait,ahk_class #32770
send, {alt down}d{alt up}c{enter}

where you have the LAST letter "c" above (to the left of {enter} ) put the first letter of YOUR COMPUTERS audio device name, in my case its called "Connexant Audio" so i use the letter c. save and your done.

When I run the first one, it opens the audio device setup, sets it to the device that starts with the letter B, and closes. I turn on whatever audio device I want to play, winamp or itunes, and it plays through the bluetooth stereo speakers. When I want to set it back, I run the 2nd file, and turn on winamp or itunes and it plays through the conexant audio device on my laptop speakers.
Photo of ZasurusZ

Zasurus

  • 5 Posts
  • 3 Reply Likes
If you are using Windows 7 (and I guess Windows Vista) the following script needs to be used.

Run, RunDll32.exe shell32.dll`,Control_RunDLL mmsys.cpl`,`,0
Sleep, 100
WinWait,ahk_class #32770
IfWinNotActive, Playback, , WinActivate, Playback,
Send, {DOWN 2}{TAB}{TAB}{DOWN 2}{ENTER}{ALTDOWN}{F4}{ALTUP}

Replace the FIRST number 2 on the last line (e.g. "Send, {DOWN 2}..." with row your device apear in the list. So for example if your is the first one in the list replace it with 1... You will need to make two files again and if you add/remove or disable etc a device that causes the device you want to select to change position in the list (say it goes from 2 to 3) then you will need to edit the script. :-)
Photo of staticnothingS

staticnothing

  • 1 Post
  • 0 Reply Likes
This is exactly what I was looking for. Next best thing to having two default devices at the same time is to be able to switch quickly between them.

FYI, for some reason since my audio properties has the "configure" button disabled, I had to change the SECOND number 2 to 1 for this to work, in case someone else runs into this problem.
Photo of MichielM

Michiel

  • 2 Posts
  • 0 Reply Likes
Strange, but I can't get the script by Zazurus to work...
I want to use the exact same config (so I also want the 2nd device to be activated) but when I run the script BOTH devices are set as standard device. When I play music still the first device is used...

I don't know what I'm doing wrong
Photo of ZasurusZ

Zasurus

  • 5 Posts
  • 3 Reply Likes
I did have some problems with that script. I have rewritten it but am in the process of moving my 2.5tb of data over to a raid 5 and can't get at the scripts currently. I will try and remember to post the fixed version by next weekend. If I haven't post another request here and when it emails me I will remember! ;-)

Zas
Photo of MichielM

Michiel

  • 2 Posts
  • 0 Reply Likes
Zas, you rule ;-)
Thank you in advance!

I've searched for other solutions, but I cant' really find one. I would like to link a hotkey to the script so I can switch audio devices with my HTPC remote. With your modified script this should all be possible.
Photo of Weasel ItoWI

Weasel Ito

  • 1 Post
  • 0 Reply Likes
I just changed the Sleep time to 150 and it worked for me.
Photo of ZasurusZ

Zasurus

  • 5 Posts
  • 3 Reply Likes
Sorry for taking so long to reply but I have found the files again now:

Run, RunDll32.exe shell32.dll`,Control_RunDLL mmsys.cpl`,`,0
WinActivate, Sound
WinWaitActive, Sound, , 2
if ErrorLevel
{
MsgBox, Sound Window not found!
return
}
ControlSend, SysListView321, {DOWN 2}, Sound
ControlSend, Button2, {DOWN 2}{ENTER}, Sound
WinClose, Sound

To change the device it selects change the "{DOWN 2}," (on the third line from the bottom in bold) to the number your device is from the top of the list. So if it is the top one change it to "{DOWN 1},"

Hope this helps!

Zas
Photo of William Crank

William Crank

  • 1 Post
  • 0 Reply Likes
awesome, this worked perfect for me, now if i can just figure out how to put those icons for each of these files, windows 7 is a little more of a pain at doing so. Plus you forgot to mention that when you change the number for "{DOWN 2}" only change the line "ControlSend, SysListView321, {DOWN 2}, Sound" and not the next line after it, i had to learn that myself. I guess that is why you have it in bold. either way, thanks so much for this little script, my savior, now if i can figure out how to change devices using like my mouse scrollwheel like i do with the volume up and down. Mostly needed for when im playing a game fullscreen and cant just switch to my desktop to do it.
Photo of ZasurusZ

Zasurus

  • 5 Posts
  • 3 Reply Likes
Oh once you have that working your going to need some icon's for it and as windows icon's are a pain to find I found these:
Heaphone: http://www.iconarchive.com/show/windo...
Speaker: http://www.iconarchive.com/show/windo...

Enjoy!

Zas
Photo of rodrigo.rcmR

rodrigo.rcm

  • 1 Post
  • 0 Reply Likes
thanks man, great solution!
btw, here's the windows audio related icon file 'C:\Windows\system32\mmres.dll'
Photo of Adam Kubacki

Adam Kubacki

  • 1 Post
  • 0 Reply Likes
If you are still there please help me, i am using your script (first edition) and when i run it every other window is closing - i can't get that working...
Photo of KYerkeK

KYerke

  • 1 Post
  • 0 Reply Likes
This was exactly what I was looking for Zas, and the new code is much better than the old since it makes it so that it won't close out of windows other than "sound" any more. Very elegant. I appreciate your effort.
Photo of k3alwaysK

k3always

  • 1 Post
  • 0 Reply Likes
i think this software might help

http://hotfile.com/dl/93761638/29be06...

its also a script made exe file
Photo of matejdroM

matejdro

  • 1 Post
  • 0 Reply Likes
All software that currently exists, opens up sound properties and change device via keyboard emulation. That works fine but real solution would be without opening windows and pressing keys. Just do it in background.
Photo of ZasurusZ

Zasurus

  • 5 Posts
  • 3 Reply Likes
Yer that would be perfect... how?
Photo of BasB

Bas

  • 2 Posts
  • 4 Reply Likes
I've made this app with AutoIT:
http://users.flexxcom.nl/ta7/toggle-a...

It rotates through the pre-set devices when launched.

you can edit the conf.ini file to your wishes, comments should clearify.

Source code included.

Bas
Photo of Harley McKenzie

Harley McKenzie

  • 1 Post
  • 0 Reply Likes
Exactly what I wanted, thanks heaps.
Photo of WizzDK

WizzDK

  • 1 Post
  • 0 Reply Likes
Thanks Bas! Trackback from: http://fragged.nu/2012/04/change-audi...
Photo of Luke Stannard

Luke Stannard

  • 1 Post
  • 0 Reply Likes
Tanks man! defo worked a treat!"
Photo of ScurKS

ScurK

  • 1 Post
  • 0 Reply Likes
I have changed the reference to conf.ini to the specific location, however I still get the "conf.ini does not exist" issue. I tried to change error-msgbox to "ROFL", but it still says "conf.ini does not exist". Therefore, I don't think the changes I'm making to the source are actually implemented on the app. Any input?
Photo of Mathew CallMC

Mathew Call

  • 1 Post
  • 0 Reply Likes
So freaking awesome! Thank you Bas. All I had to do to get it to work flawlessly on my Windows 7, 64-bit Dell laptop was disable all the other audio devices except the 2 I wanted to toggle then uncheck "Show Disabled Devices" so that they are hidden.
Photo of Rudicuul Gezichtboek

Rudicuul Gezichtboek

  • 1 Post
  • 0 Reply Likes
Just wanted to say Zas' first solution with autohotkey worked for me, and his second didn't. Thanks for the help, great job! Really appreciate.
Photo of mogensfriishansenM

mogensfriishansen

  • 1 Post
  • 0 Reply Likes
Heya, Bas, I keep getting "Conf.ini does not exist", when I have the file hotkeyed with autohotkey, do you know why? It works fine when I just double click the file, but not when I use the shortcut
Photo of BasB

Bas

  • 2 Posts
  • 4 Reply Likes
You could download AutoIT (http://autoitscript.com) and take a look at the source code. It's quite easy.

If you change the references to "conf.ini" to, for example, "c:\conf.ini" you can set a fixed path.
Photo of paulovilliP

paulovilli

  • 2 Posts
  • 0 Reply Likes
AutoHotkey launches apps ok but it changes their working folder, that's why the app fails to find "conf.ini"

I'm not sure which folder is considered, but i would bet this is an unintended behavior and its autohotkey's folder that gets used
Photo of JohnJ

John

  • 1 Post
  • 0 Reply Likes
Bas! Thanks for the awesome script. And I'd like to give a big FUCK YOU to the Microsoft engineers that SPECIFICALLY ADDED CODE to prevent streams from outputting to multiple audio outputs (it used to work in an old driver version). Microsoft, adding tons of features nobody wants while breaking the only ones that work and leaving them broken for years. I hope they all burn in hell. (can you tell this has been frustrating me?)
Photo of abhirajA

abhiraj

  • 2 Posts
  • 0 Reply Likes
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.Run("RunDll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,2");
WScript.Sleep(100);
WshShell.AppActivate("Sounds and Audio Devices Properties");
WScript.Sleep(100);
WshShell.SendKeys("{DOWN}{ENTER}");
WScript.Sleep(100);
WScript.Echo(WshShell.RegRead("HKEY_CURRENT_USER\\Software\\Microsoft\\Multimedia\\Sound Mapper\\Playback"));
Photo of abhirajA

abhiraj

  • 2 Posts
  • 0 Reply Likes
Copy this to a file and name it ".js" Works fine on Windows XP
Photo of vitalious

vitalious

  • 1 Post
  • 0 Reply Likes
Great solution guys!!!
How did you change the icon of a file associated with an application though?
Photo of Justin Bil

Justin Bil

  • 1 Post
  • 0 Reply Likes
Just wanted to thank everyone for sharing this!
Photo of Ben-John Walker

Ben-John Walker

  • 1 Post
  • 0 Reply Likes
I also get the conf.ini does not exist, when i use the shortcut with the toggle audio, but the strange thing is, when i change the shortcut key, it will work again, but as soon as i reboot, if throws the error: conf.ini does not exist, its driving me crazy, but great work on the app :-)
Photo of Dailen Gunter

Dailen Gunter

  • 1 Post
  • 1 Reply Like
http://blog.nirsoft.net/2011/06/29/3-...

Much better solution, copy nircmd to your C:\Windows directory then create a shortcut on your desktop that goes to:

nircmd.exe NirCmd.exe setdefaultsounddevice "(Device Name)"

and BAM you're done.
Photo of James DelidesJD

James Delides

  • 1 Post
  • 0 Reply Likes
Signed up just to thank you for posting that, Dailen. Brilliant fix you've got there.