Sign in to follow this  
Followers 0
WhiteAvenger

Change Speaker setup

12 posts in this topic

Hi,

I have a 5.1 speaker system on my PC. This is great obviously, except evenings, when I have to put on headphones so as not to disturb the neighbour's kids.

The problem is that when I simply plug in my headphones, the system still thinks it's 5.1 and adjusts the sound accordingly - meaning that it's all too quiet.

Anyways, I have to manually change the system sound scheme: Control Panel>Sound and Audio Devices>Volume Tab>Speaker Settings>Advanced>Select scheme from dropdown list. (9 Clicks minimum)

Or I Doubleclick on the Realtek Icon in my tasktray, go to Audio I/O and then select the speaker scheme. (6 Clicks min.)

I now want to write a script which changes the scheme automatically for me, but I can't find how.

I already have looked at the sound.au3, but that doesn't allow to change the speaker scheme. Is there a simple way to do that? Or do I have to go all the way every time?

Thanks

--WhiteAvenger

Share this post


Link to post
Share on other sites



Dont think thats for this forum. Try chat.

Share this post


Link to post
Share on other sites

I don't know if there's any 'direct' way (API or DLL calls or something) of doing it, but you could always do it AutoIt2 style- open the cpl applet you need, click at specified x,y coord within window, etc...

It would at least be faster than doing it manually each time... :-D


"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites

Dont think thats for this forum. Try chat.

Yes it is for this forum; I am asking for information on how to do something with AutoIt.

I don't know if there's any 'direct' way (API or DLL calls or something) of doing it, but you could always do it AutoIt2 style- open the cpl applet you need, click at specified x,y coord within window, etc...

It would at least be faster than doing it manually each time... :-D

That's a good idea, however...

the Window opens at a different place every time i open it. So my script is useless...

Share this post


Link to post
Share on other sites

This aplication remembers your setting after powering Pc down yes ? If True then it must hold somewhere your settings, in .ini file or register ! Just try to find this file or key in reg and change the value in it to change the program settings.


Share this post


Link to post
Share on other sites

This aplication remembers your setting after powering Pc down yes ? If True then it must hold somewhere your settings, in .ini file or register ! Just try to find this file or key in reg and change the value in it to change the program settings.

I don't think this will be a viable option, since you would have to restart your computer for the changes to take effect if it's a registry setting. I think the dropdown box also reinitializes the sound settings. If you figured out how this worked you could maybe do it.

Now what I found out from google was that if you put "mmsys.cpl" in the Run command prompt you directly get to the sound panel. You could easily do that with AutoIt and work from there with ControlClick. Just can't do it for you atm since I am at work here and we are still on Win2k, nothing with surround and all that.

Share this post


Link to post
Share on other sites

WhiteAvenger

Try this:

Dim $MainTitle = "Свойства: Звуки и аудиоустройства" ;I not have english OS version, get the title from Autoit window info
Dim $AdvTitle = "Дополнительные свойства звука"

Run("rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl")
WinWait($MainTitle)
ControlClick($MainTitle, "", "Button7")
WinWait($AdvTitle)
$hCombo = ControlGetHandle($AdvTitle, "", "ComboBox1")
ControlCommand($AdvTitle, "", "ComboBox1", "SetCurrentSelection", 11)
Sleep(500)
ControlClick($AdvTitle, "", "Button1")
WinClose($MainTitle)
:)

Share this post


Link to post
Share on other sites

Nice one, that's pretty much how I would have done it, good work.

Share this post


Link to post
Share on other sites

Run("rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl")oÝ÷ Ûú®¢×+jvÞ²)©'âyÖ¬jëh×6Run("control mmsys.cpl")oÝ÷ Ù«j¶¬!ú.Ú.¶«¨µéÚ
Great, that's a good way to do this! Thanks

Is there a way of finding out which selection the ComboBox is already set to? That would make it really easy to change between headphones and 5.1...

Share this post


Link to post
Share on other sites

Great, that's a good way to do this! Thanks

Is there a way of finding out which selection the ComboBox is already set to? That would make it really easy to change between headphones and 5.1...

Does ControlGetText($AdvTitle, "", "ComboBox1") work?

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110

Share this post


Link to post
Share on other sites

Does ControlGetText($AdvTitle, "", "ComboBox1") work?

I don't know - I just took a blind guess and used ControlCommand($AdvTitle, "", "ComboBox1", "GetCurrentSelection").

That works fine - however, even though the Windows settings are on "headphones", the Realtek settings don't change, and therefore, the speaker setup doesn't, either.

Does anyone know a way of opening the "Realtek HD Audio Manager"?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0