Sign in to follow this  
Followers 0
DBSights

Sounds and Audio Devices

3 posts in this topic

Hey, pretty new to autoit, but im trying to create a script to automate my winamp startup.

I have both speakers and a headset, and i like to have the winamp come through the speakers while the ventrilo and all other sounds come through the headset. To do this, i switch my default sound device to the speakers, start playing a song in winamp, and then switch the default device back to the headset. I'm not realyl sure where i went wrong, but i really know nothing about the syntax. I tried the best I could with the online documentation, but I could use some pointers from people who know autoit. thx

CODE
; DBSIGHTS - Automated Startup Routine (WINAMP)

; #Creates WINAMP if it does not exist

; #Opens Sound Control Panel

; #Switches from headset to speakers

; #Plays a song in WINAMP using global hotkeys and then selects the next song

; #Switches from speakers to headset

; #Closes Sound Control Panel

If Not ProcessExists('winamp.exe') Then

Run(@ProgramFilesDir & '\Winamp\winamp.exe')

EndIf

ProcessWait('winamp.exe')

sleep( 320 )

run('rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,2')

winwait('Sound and Audio Devices Properties')

sleep( 320 )

ControlCommand('Sound and Audio Devices Properties',"" , 6662 , "SelectString", 'Realtek')

ControlClick('Sound and Audio Devices Properties',"", 12321 , 'left' , 1)

send("^!{INS}")

send("^!{PGDN}")

ControlCommand('Sound and Audio Devices Properties',"" , 6662 , "SelectString", 'Plantronics')

ControlClick('Sound and Audio Devices Properties',"", 1 , 'left' , 1)

Exit

Share this post


Link to post
Share on other sites



It is possible to configure Winamp to use a specific device instead of the default one..

I can do the following : Options -> Preferences -> Plugins -> Output -> DirectSound output

Share this post


Link to post
Share on other sites

Hey, pretty new to autoit, but im trying to create a script to automate my winamp startup.

I have both speakers and a headset, and i like to have the winamp come through the speakers while the ventrilo and all other sounds come through the headset. To do this, i switch my default sound device to the speakers, start playing a song in winamp, and then switch the default device back to the headset. I'm not realyl sure where i went wrong, but i really know nothing about the syntax. I tried the best I could with the online documentation, but I could use some pointers from people who know autoit. thx

CODE
; DBSIGHTS - Automated Startup Routine (WINAMP)

; #Creates WINAMP if it does not exist

; #Opens Sound Control Panel

; #Switches from headset to speakers

; #Plays a song in WINAMP using global hotkeys and then selects the next song

; #Switches from speakers to headset

; #Closes Sound Control Panel

If Not ProcessExists('winamp.exe') Then

Run(@ProgramFilesDir & '\Winamp\winamp.exe')

EndIf

ProcessWait('winamp.exe')

sleep( 320 )

run('rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,2')

winwait('Sound and Audio Devices Properties')

sleep( 320 )

ControlCommand('Sound and Audio Devices Properties',"" , 6662 , "SelectString", 'Realtek')

ControlClick('Sound and Audio Devices Properties',"", 12321 , 'left' , 1)

send("^!{INS}")

send("^!{PGDN}")

ControlCommand('Sound and Audio Devices Properties',"" , 6662 , "SelectString", 'Plantronics')

ControlClick('Sound and Audio Devices Properties',"", 1 , 'left' , 1)

Exit

I think your control ID's will give problems and I would do it a bit differently by just using the position of everything in the 'Sound and Audio Decives Properties' window. This is a simple approach but it works well for me.

After starting the sounds and audio devices panel

WinWaitActive('Sound and Audio Decives Properties')

$CPSize = WinGetPos("")

MouseClick("left",$CPsize[0] + X, $CPsize[1] + Y) ;change Xand Y to be somewhere in the combo box you want to select Realtek or whatever

Send("Realtek");this will select the first Realtek device

Send("Local")

Send("{Enter}");really selects it

etc ..

..using just the coords and mouse clicks at positions and send.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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