Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Batch file to change default audio device


02 Jul 2011   #1

Windows 7 64bit
 
 
Batch file to change default audio device

Hi all,

I have my computer hooked up to a home theater system. Most of the time, my computer audio output is set to my on-board motherboard audio connected to simple speakers, but I frequently switch the default device to digital output through my sound card (HTO Striker 7.1).

My goal is to create a file that I can keep on the desktop that will switch the default audio device. In a perfect world, it would switch back and forth between the 2 settings that I use, but I understand that it might be too much to ask for.

I have a bit of experience with batch files in XP, but that was essentially reverse-engineering things that I found online. Any help would be appreciated. Thanks

My System SpecsSystem Spec
.

02 Jul 2011   #2

Microsoft Community Contributor Award Recipient

Win 7 Home Premium 64bit Ver 6.1.7600 Build 7601 - SP1
 
 

Hi! Mr D, welcome to 7F

Would hotkeys fill the bill?

Quote:
Source: AutoHotkey - Free Mouse and Keyboard Macro Program with Hotkeys and AutoText
My System SpecsSystem Spec
02 Jul 2011   #3

Windows 7 64bit
 
 

I'm hopefully looking for a solution that does not involve an additional program. I have a Logitech G11 keyboard, which has 18 customizable macro keys and its own macro program. I don't think there is a way within the Logitech program to change the default audio device, but I could be wrong, and I'll take a closer look
My System SpecsSystem Spec
.


02 Jul 2011   #4

Microsoft Community Contributor Award Recipient

Win 7 Home Premium 64bit Ver 6.1.7600 Build 7601 - SP1
 
 

Understood if you have a keyboard that can do that, you would not want additional programs.

Take a look at this, It shows how to program the G-11 macros, and at the bottom it even describes how to include mouse clicks that would be very helpful during your programming of changing the sound devices.

Legacy Software - Programming macros on my G11 keyboard
My System SpecsSystem Spec
03 Jul 2011   #5

Windows 7 64bit
 
 

Thanks for the link. I think that once I have a file that can change the audio device, I can easily link to it through a macro. As far as I can tell, there is no way to access the terminal through the macro program, and even if there was, I need to figure out what commands to use.
My System SpecsSystem Spec
03 Jul 2011   #6

Microsoft Community Contributor Award Recipient

Win 7 Home Premium 64bit Ver 6.1.7600 Build 7601 - SP1
 
 

Your welcome, but I do not understand your difficulty.

It would seem to me that once you start the macro program on the G-11 you would then preform the actions you do now to change from the on-board to the sound card whether or not it included a mixture of keys or clicks, then you save that macro as, lets say 'S_C' for Sound_Card to a key or key combo.

To change back to the on-board you start a fresh G-11 macro, preform the actions to do that, save that macro as 'O_B' to a key or key combo, and your done.

Not knowing the G-11 macro program it may even allow you to save the macro as a shorcut to your desktop, but I did not read that far.

Am I missing anything? That is how I used to make macros in Excel, and I had some doozys that would jump across several workbooks, files, and then to the printer.
My System SpecsSystem Spec
03 Jul 2011   #7

Windows 7 64bit
 
 

The problem is that my current way of selecting the default audio device is to right-click on the sound icon, choose "playback devices", and then select the correct device. The macro program can record "mouse actions", which is restricted to the buttons and scroll, nothing about moving around the screen and doing something this complicated.

I've done what you are describing in Excel, but Visual Basic is a more powerful language, and never requires any mouse movement/actions.
My System SpecsSystem Spec
03 Jul 2011   #8

Microsoft Community Contributor Award Recipient

Win 7 Home Premium 64bit Ver 6.1.7600 Build 7601 - SP1
 
 

That is just it, it does not need to track movement, it should just record your next click. What does it care how you get there it just needs to know your next choice.

What does it hurt to try?

I gotta go we are having a bad lighting storm and I am shutting down for the night.
My System SpecsSystem Spec
03 Jul 2011   #9

Windows 7 64bit
 
 

The macro program can only track simple mouse commands. If I were to press record and then do what I normally do, the result would look like this:

Right-Click
Left-Click
Left-Click
Left-Click

I believe that I could create a macro that would go through the start menu, open audio devices, and then change the default using keystrokes, but that is not very efficient, and could be easily messed up by an accidental keystroke in the middle. I am really hoping for something like this:

1) Macro Button activates a specific batch file (I can do this part)
2) Batch file uses terminal commands to change the audio device (hopefully without extra windows being opened)

It seems to me that there should be a relatively simple command that changes the default audio device from the terminal, but I do not have enough experience to know what it is.
My System SpecsSystem Spec
03 Jul 2011   #10

Windows 7 64bit
 
 

I just found this: Changing default audio deviceThey have some solutions that will quickly open the sound menu and select a different device. This is adequate, but if anyone knows a solution that does not rely on opening new windows, that would be preferable.
My System SpecsSystem Spec
Reply

 Batch file to change default audio device




Thread Tools




Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 09:31 PM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

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