Jump to content

[Solved] Windows 7 - Audio Card Switcher


IanN1990
 Share

Recommended Posts

Heya,

My pc has two audio cards inside, one for my main pc speakers and one for my wireless headphones. I have been using some software called "Coastal Audio Changer" which does kinda work but has always been a bit buggy.

So i decided to write something in autoit to do the same task. :D

but i run into a slight problem.

Here is the code so far

while 1
$a = ControlGetPos('[CLASS:#32770]','','')
If IsArray($a) Then
       If $a[2] >250 And $a[3] >250 Then
  SendKeepActive("[CLASS:#32770]")
   Send("{HOME}")
   send("{Tab 2}")
   send("{Enter}")
WEnd

So it sends Home "which selects the top card", then sends 2 tabs and then enter for setting it as default. but i need a way to open this window "see picture below"

Anyone have any ideas?

*Extra Info Windows 7 Professional N (64bit)

Edited by IanN1990
Link to comment
Share on other sites

? a interesting thing would of saved me some time but i have already written my code just needed the "/ to finish it off.

I have a autoit.exe that runs at startup. I hot keyed F12 to my script running

#NoTrayIcon
HotKeySet("^{F12}", "_F12")
local $Sound=0
Func _F12()
if $Sound=0 Then
$Sound=1
run("C:Program Files (x86)Scripts00¦ MiscellaneousMicrosoftWireless.exe")
else
$Sound=0
run("C:Program Files (x86)Scripts00¦ MiscellaneousMicrosoftMain.exe")
EndIf
EndFunc

Run("C:\Windows\System32\control.exe mmsys.cpl")
while 1
sleep(50)
$a = ControlGetPos('[CLASS:#32770]','','')
If IsArray($a) Then
       If $a[2] >250 And $a[3] >250 Then
  SendKeepActive("[CLASS:#32770]")
   Send("{End}")
   send("{Tab 2}")
   send("{Enter 2}")
    send("{VOLUME_DOWN 50}")
   Exit
  EndIf
EndIf
WEnd

which opens the sound, selects the bottom item which is my main speakers, sets as default, and then decreases the volume by 100

and

Run("C:\Windows\System32\control.exe mmsys.cpl")
while 1
sleep(50)
$a = ControlGetPos('[CLASS:#32770]','','')
If IsArray($a) Then
       If $a[2] >250 And $a[3] >250 Then
  SendKeepActive("[CLASS:#32770]")
   Send("{Home}")
   send("{Tab 2}")
   send("{Enter 2}")
    send("{VOLUME_UP 50}")
   Exit
  EndIf
EndIf
WEnd

which opens the sound, selects the top item which is my wireless, sets as default, and then increases the volume by 100 **cuz otherwise the headphone transmitter doesn't turn on as it cant hear anything ^^ I do love :D

So Prob not very professional but it works very quickly compared to the software i was using and is 100% effective compared to hit&miss.

Edited by IanN1990
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...