Shortcuts to Change Speaker Modes

Anything and everything software related that doesn't fit above can go in here!
Post Reply
Sovereign
Legit Extremist
Legit Extremist
Posts: 1045
Joined: Sun May 08, 2005 5:28 pm

Shortcuts to Change Speaker Modes

Post by Sovereign »

I have a roommate (I'm in college) and there's an unspoken rule that in general, when the other is there you use headphones. That's fine, but since I have an X-Fi everything sounds funny if it's set on "2.1 Speakers" when I'm listening through headphones (no, the software cannot detect whether I am using headphones or speakers). Thus, I have to open the control panel (for the X-Fi), change the setting, then close it again. It's annoying. Some Googling produced this forum post which I modified to suit an X-Fi (even the simple things, like "Audio Console," break the VBS, it needs to be "Audio Control Panel").

This is not my code (see above source); I just made it X-Fi compliant.

Code: Select all

' ================== 1st script ====================

'----- Start Of "Headpones.vbs" ----- (Save as Headphones.vbs) ---------------------

Option Explicit

Dim WshShell
Set WshShell = CreateObject("WScript.Shell" )

' Start up the Audio Console
WshShell.CurrentDirectory = "C:\Program Files (x86)\Creative\AudioCS\"
WshShell.Run "CTAudCS.exe"
' lets open the console
While WshShell.AppActivate("Audio Control Panel") = FALSE
wscript.sleep 200
WshShell.AppActivate "Audio Control Panel"
Wend
'
' send some keystrokes to get the speaker settings box activated
'
'
WshShell.SendKeys("{TAB}{TAB}{TAB}{RIGHT}{TAB}{TAB}" )

'
' set the speaker selection to Headphones
'
WshShell.SendKeys("{h}" )
'
' exit Audio Control Panel -panel
'
WshShell.SendKeys("{TAB}{TAB}{ENTER}" )

WScript.Quit(0)

'----- End Of "Headphones.vbs" -------------------------------------------------------------

Code: Select all

' ================== 2nd script ====================


'----- Start Of "2.1.vbs" ----- (Save as 2.1.vbs) -------------------------------------------

Option Explicit

Dim WshShell
Set WshShell = CreateObject("WScript.Shell" )

' Start up the Audio Console
WshShell.CurrentDirectory = "C:\Program Files (x86)\Creative\AudioCS\"
WshShell.Run "CTAudCS.exe"
' lets open the console
While WshShell.AppActivate("Audio Control Panel") = FALSE
wscript.sleep 200
WshShell.AppActivate "Audio Control Panel"
Wend
'
' send some keystrokes to get the speaker settings box activated
'
'
WshShell.SendKeys("{TAB}{TAB}{TAB}{RIGHT}{TAB}{TAB}" )

'
' set the speaker selection to 2.1
'
WshShell.SendKeys("{2}" )
'
' exit Audio Control Panel -panel
'
WshShell.SendKeys("{TAB}{TAB}{ENTER}" )

WScript.Quit(0)

'----- End Of "Headphones to 2.1.vbs" -----
Note that if you change "SendKeys" you can change what mode you're activating.

H - Headphones
2 - 2.1 Speakers
4 - 4.1 Speakers
5 - 5.1 Speakers
7 - 7.1 Speakers

Make sure the Control Panel is closed before you use these. You do not need to "Run as Administrator" on Vista; they just work. Also note that the program path assumes Vista x64 (which has a "Program Files (x86)" folder that does not exist on 32-bit Vista; it's just Program Files.)
Play
Q6600 @ 3.2GHz :: 8GB DDR2-800 :: eVGA 9800GX2 :: 7900GTX (secondary) :: abit IP35 Pro :: 150GB Raptor 10k RPM :: 2x750GB WD Caviar :: 120GB WD :: X-Fi XtremeMusic :: NEC 4551A :: BenQ DVD Combodrive (52x32x52) :: Dual 22" Acer AL2216W :: Thermaltake Armor Black :: Logitech Z5500 5.1

Work
Core 2 Duo @ 2.53GHz :: 4GB DDR3 @ 1067MHz :: 3670 :: Intel PM45 Chipset :: 500GB 5400RPM SATA :: Integrated Audio :: BD-ROM/DVD Burner :: 16" 1920x1080 RGBLED
Post Reply