gertsolo Posted September 17, 2007 Share Posted September 17, 2007 Hey there, I'm new to AutoIt so be gentle. Would it be possible to change the audio adapter from one to another with AutoIt. I'll explain myself. I have an onboard audio adapter and a soundblaster card. From time to time I want to change the one windows should use. This is normally done through control panel -> sounds and audio settings -Audio tab -> and then device for audio where you can choose the adapter. thx in advance GertSolo The more you learn, the less you know. Link to comment Share on other sites More sharing options...
weaponx Posted September 17, 2007 Share Posted September 17, 2007 A quick google search turned up an old utility: http://www.phasequest.com/soundcardpicker.htm Link to comment Share on other sites More sharing options...
weaponx Posted September 17, 2007 Share Posted September 17, 2007 (edited) Since i'm sick of looking at php code I created the ULTIMATE AUDIO SWITCHER! Ok it's not that ultimate. This will load the audio control panel, determine the current device, and if there is more than one it will cycle to the next audio device. If there are only 2 devices to choose from it will toggle. Also, it will display a traytip with the name of the device being switched to. #Include <GuiCombo.au3> #Include <GuiTab.au3> $title = "Sounds and Audio Devices Properties" Run('"C:\WINDOWS\system32\rundll32.exe" C:\WINDOWS\system32\shell32.dll,Control_RunDLL "C:\WINDOWS\system32\MMSYS.CPL",@0') WinWaitActive($title) $tabHwnd = ControlGetHandle ( $title, "", "[CLASS:SysTabControl32; INSTANCE:1]" ) If @ERROR THEN MsgBox(0,"","ERROR") _GUICtrlTabSetCurFocus ( $tabHwnd, 2) _GUICtrlTabSetCurSel ( $tabHwnd, 2) $comboHWND = ControlGetHandle ($title, "", "[CLASS:ComboBox; INSTANCE:1]" ) If @ERROR THEN MsgBox(0,"","ERROR") $itemCount = _GUICtrlComboGetCount ($comboHWND) $currentIndex = _GUICtrlComboGetCurSel ($comboHWND) If $currentIndex < $itemCount - 1 Then _GUICtrlComboSetCurSel ( $comboHWND, $currentIndex + 1 ) $newIndex = $currentIndex + 1 Else _GUICtrlComboSetCurSel ( $comboHWND, 0) $newIndex = 0 EndIf $result = "" _GUICtrlComboGetLBText ( $comboHWND, $newIndex, $result) ControlClick($title, "", "Button11") TrayTip ( "Audio device switched to:", $result, 5) Sleep(5000) Edited September 17, 2007 by weaponx Link to comment Share on other sites More sharing options...
gertsolo Posted September 18, 2007 Author Share Posted September 18, 2007 Thx weaponx, exactly what I need. More power to ya! GertSolo The more you learn, the less you know. Link to comment Share on other sites More sharing options...
gertsolo Posted September 18, 2007 Author Share Posted September 18, 2007 (edited) Hey Weaponx, one question though, I tried it today on a English XP and it worked fine. Here at home I'm using a dutch version of XP. Should I change something in the script to get it running again? Now it stops after opening the audio control dialog. BTW on this PC I got 3 audio adapter. Edit: never mind I got it, just had to change the $title value, my bad, very nooby... rgds! Edited September 18, 2007 by gertsolo The more you learn, the less you know. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now