Quantcast

Maximum PC

It is currently Tue Sep 16, 2014 1:54 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Shortcuts to Change Speaker Modes
PostPosted: Thu Jan 29, 2009 6:11 pm 
Team Member Top 500
Team Member Top 500
User avatar

Joined: Thu Dec 23, 2004 2:34 pm
Posts: 3974
Location: Building my 4-8-9
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:
' ================== 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:
' ================== 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.)


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group