| Windows 7: Batch file to change default audio device |
02 Jul 2011
|
#1 | | |
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 Specs |
| |
02 Jul 2011
|
#2 | | Win 7 Home Premium 64bit Ver 6.1.7600 Build 7601 - SP1 Central Pa. |
Hi! Mr D, welcome to 7F
Would hotkeys fill the bill? Quote: - Change the volume, mute, and other settings of any soundcard.
- Make any window transparent, always-on-top, or alter its shape.
- Use a joystick or keyboard as a mouse.
- Monitor your system. For example, close unwanted windows the moment they appear.
- Retrieve and change the clipboard's contents, including file names copied from an Explorer window.
- Disable or override Windows' own shortcut keys such as Win+E and Win+R.
- Alleviate RSI with substitutes for Alt-Tab (using keys, mouse wheel, or buttons).
- Customize the tray icon menu with your own icon, tooltip, menu items, and submenus.
- Display dialog boxes, tooltips, balloon tips, and popup menus to interact with the user.
- Perform scripted actions in response to system shutdown or logoff.
- Detect how long the user has been idle. For example, run CPU intensive tasks only when the user is away.
- Automate game actions by detecting images and pixel colors (this is intended for legitimate uses such as the alleviation of RSI).
- Read, write, and parse text files more easily than in other languages.
- Perform operation(s) upon a set of files that match a wildcard pattern.
- Work with the registry and INI files.
Source: AutoHotkey - Free Mouse and Keyboard Macro Program with Hotkeys and AutoText | My System Specs | | Computer type PC/Desktop System Manufacturer/Model Number Gateway DX4831e (Mid-Tower Desktop) OS Win 7 Home Premium 64bit Ver 6.1.7600 Build 7601 - SP1 CPU Intel i3 530 2.93GHz, 2933MHz 2 Cores 4 Logical Processors Motherboard Gateway H57M01 133 megahertz Memory 6GB of 1,333MHz DDR3 SDRAM Graphics Card 32MB Intel Graphics Media Accelerator HD IGChip Sound Card Realtek High Definition Audio Monitor(s) Displays Gateway HX2000 20inch TFT active matrix TN Screen Resolution 1600 x 900 x 59 hertz Keyboard MS 'Natural' Standard PS/2 Enhanced 101-102 Key Mouse Gateway USB wired optical PSU 300watts. Case Mid-Tower Desktop Cooling Stock from Gateway Hard Drives WDC WD10EADS-00M2B0 [HDD] (1000.20 GB) -- drive 0,
HL-DT-ST DVDRAM GH41N [CD-ROM dr]
HP Photosmart Plus B210a e_series AIO Printer
Four card readers, and Four USB 2.0 Internet Speed Verizon FIOS 24.57Mbps Down - 5.68Mbps up Antivirus MSE Browser IE9.0.8112.16421-Upd ver 9.0.13, FireFox 19.2, Opera 12.14 Other Info BIOS: American Megatrends Inc. P01-A0 11/17/2009
System Specs by Belarc.
Join Date March 27th 2010 at 10:44:15 AM. |
02 Jul 2011
|
#3 | | |
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 Specs | | |
02 Jul 2011
|
#4 | | Win 7 Home Premium 64bit Ver 6.1.7600 Build 7601 - SP1 Central Pa. |
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 Specs | | Computer type PC/Desktop System Manufacturer/Model Number Gateway DX4831e (Mid-Tower Desktop) OS Win 7 Home Premium 64bit Ver 6.1.7600 Build 7601 - SP1 CPU Intel i3 530 2.93GHz, 2933MHz 2 Cores 4 Logical Processors Motherboard Gateway H57M01 133 megahertz Memory 6GB of 1,333MHz DDR3 SDRAM Graphics Card 32MB Intel Graphics Media Accelerator HD IGChip Sound Card Realtek High Definition Audio Monitor(s) Displays Gateway HX2000 20inch TFT active matrix TN Screen Resolution 1600 x 900 x 59 hertz Keyboard MS 'Natural' Standard PS/2 Enhanced 101-102 Key Mouse Gateway USB wired optical PSU 300watts. Case Mid-Tower Desktop Cooling Stock from Gateway Hard Drives WDC WD10EADS-00M2B0 [HDD] (1000.20 GB) -- drive 0,
HL-DT-ST DVDRAM GH41N [CD-ROM dr]
HP Photosmart Plus B210a e_series AIO Printer
Four card readers, and Four USB 2.0 Internet Speed Verizon FIOS 24.57Mbps Down - 5.68Mbps up Antivirus MSE Browser IE9.0.8112.16421-Upd ver 9.0.13, FireFox 19.2, Opera 12.14 Other Info BIOS: American Megatrends Inc. P01-A0 11/17/2009
System Specs by Belarc.
Join Date March 27th 2010 at 10:44:15 AM. |
03 Jul 2011
|
#5 | | |
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 Specs | | |
03 Jul 2011
|
#6 | | Win 7 Home Premium 64bit Ver 6.1.7600 Build 7601 - SP1 Central Pa. |
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 Specs | | Computer type PC/Desktop System Manufacturer/Model Number Gateway DX4831e (Mid-Tower Desktop) OS Win 7 Home Premium 64bit Ver 6.1.7600 Build 7601 - SP1 CPU Intel i3 530 2.93GHz, 2933MHz 2 Cores 4 Logical Processors Motherboard Gateway H57M01 133 megahertz Memory 6GB of 1,333MHz DDR3 SDRAM Graphics Card 32MB Intel Graphics Media Accelerator HD IGChip Sound Card Realtek High Definition Audio Monitor(s) Displays Gateway HX2000 20inch TFT active matrix TN Screen Resolution 1600 x 900 x 59 hertz Keyboard MS 'Natural' Standard PS/2 Enhanced 101-102 Key Mouse Gateway USB wired optical PSU 300watts. Case Mid-Tower Desktop Cooling Stock from Gateway Hard Drives WDC WD10EADS-00M2B0 [HDD] (1000.20 GB) -- drive 0,
HL-DT-ST DVDRAM GH41N [CD-ROM dr]
HP Photosmart Plus B210a e_series AIO Printer
Four card readers, and Four USB 2.0 Internet Speed Verizon FIOS 24.57Mbps Down - 5.68Mbps up Antivirus MSE Browser IE9.0.8112.16421-Upd ver 9.0.13, FireFox 19.2, Opera 12.14 Other Info BIOS: American Megatrends Inc. P01-A0 11/17/2009
System Specs by Belarc.
Join Date March 27th 2010 at 10:44:15 AM. |
03 Jul 2011
|
#7 | | |
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 Specs | | |
03 Jul 2011
|
#8 | | Win 7 Home Premium 64bit Ver 6.1.7600 Build 7601 - SP1 Central Pa. |
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 Specs | | Computer type PC/Desktop System Manufacturer/Model Number Gateway DX4831e (Mid-Tower Desktop) OS Win 7 Home Premium 64bit Ver 6.1.7600 Build 7601 - SP1 CPU Intel i3 530 2.93GHz, 2933MHz 2 Cores 4 Logical Processors Motherboard Gateway H57M01 133 megahertz Memory 6GB of 1,333MHz DDR3 SDRAM Graphics Card 32MB Intel Graphics Media Accelerator HD IGChip Sound Card Realtek High Definition Audio Monitor(s) Displays Gateway HX2000 20inch TFT active matrix TN Screen Resolution 1600 x 900 x 59 hertz Keyboard MS 'Natural' Standard PS/2 Enhanced 101-102 Key Mouse Gateway USB wired optical PSU 300watts. Case Mid-Tower Desktop Cooling Stock from Gateway Hard Drives WDC WD10EADS-00M2B0 [HDD] (1000.20 GB) -- drive 0,
HL-DT-ST DVDRAM GH41N [CD-ROM dr]
HP Photosmart Plus B210a e_series AIO Printer
Four card readers, and Four USB 2.0 Internet Speed Verizon FIOS 24.57Mbps Down - 5.68Mbps up Antivirus MSE Browser IE9.0.8112.16421-Upd ver 9.0.13, FireFox 19.2, Opera 12.14 Other Info BIOS: American Megatrends Inc. P01-A0 11/17/2009
System Specs by Belarc.
Join Date March 27th 2010 at 10:44:15 AM. |
03 Jul 2011
|
#9 | | |
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 Specs | | |
03 Jul 2011
|
#10 | | |
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 Specs | | Batch file to change default audio device problems? All times are GMT -5. The time now is 03:15 AM. | |