Jump to content
Sign in to follow this  
GrizDoug

Vista Sound Dialog configuration script

Recommended Posts

GrizDoug

I have a script that I am using on a Vista machine in the Sound dialog, which can be accessed by clicking the white speaker in the lower right corner of the windows screen in the tray. I am putting together a script to set the Playback and Recording device configurations (levels, mute, etc.). I can set the default devices for both Playback and Recording. I can set most levels and advanced settings for the various devices, but I'm having a problem with the Realtek HD Audio microphone and Realtek HD Audio stereo mix. I have not found a way to access these so that I can set the volume slider or the mute button and have the values persist. I've looked at some examples, and people have created libraries that do some of this work, either through using COM or some other methodology. Has anyone out there solved this problem or created a library that solves this problem for the microphone or stereo mix? Any assistance would be greatly appreciated. Thanks in advance.


Gotta keep on truckin' to find the perfect solution, but sometimes you run into roadblocks, so you gotta jam right through those roadblocks!!

Share this post


Link to post
Share on other sites
FireFox

@GrizDoug

tested Sound UDF by Volly ?

Cheers, FireFox


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
GrizDoug

@GrizDoug

tested Sound UDF by Volly ?

Cheers, FireFox

I found the SoundGetSetQuery.au3 and SoundExample.au3. Is that what you meant? These don't have anything about Stereo Mix. Where do I find the Sound UDF by Volly? Thanks in advance.


Gotta keep on truckin' to find the perfect solution, but sometimes you run into roadblocks, so you gotta jam right through those roadblocks!!

Share this post


Link to post
Share on other sites
Melba23

GrizDoug,

Sound.au3 is by RazerM (and a bit by me) and can be found here, but I do think it will be of any use to you as it uses the Window MCI dll to control audio files and does not touch the audio controls.

There is also Audio.au3 by Volly, which can be found here, which contains the following:

_SoundSetMasterVolume($iVolume) - Sets the Master Volume. Does not control an application's volume

_SoundGetMasterVolume - Gets the Master Volume level

_SoundSetMicrophoneVolume - Sets the Microphone input volume

_SoundGetMicrophoneVolume - Gets the Microphone volume level

_SoundGetPhoneVolume - Gets the Phone volume on the modem

_SoundSetVolumeCD - Sets the Volume level on the CDRom

_SoundSetMasterWaveVolume - Sets the Master Wave Volume level

However, Vista sound is pretty much self contained and trying to change things on a system wide basis may not be possible. A number of audio threads have commented on the fact that Vista only allows you to change the parameters for the running program itself. So you may be on a wild goose chase, I am sorry to say. If you find out different - please let us all know!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
FireFox

@M23

ops sorry... i know that because volly posts some scripts greats not made by him :)

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Melba23

FireFox,

Pas de probleme, mon ami. L'important c'est qu'il trouve les UDF!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
GrizDoug

FireFox,

Pas de probleme, mon ami. L'important c'est qu'il trouve les UDF!

M23

Hi M23 and All,

I found a solution to this issue by combining the AutoIt and AutoHotkey scripting languages. I have a script that I have written in the AutoHotkey language that allows me to set all the device volume and mute values, even the Realtek HD Audio microphone and stereo mix. I only use this script to set these values and then I use the AutoIt scripting language to do the rest of the configuration for the Vista Sound dialog Playback and Recording devices. The way it all works together, I run the AutoIt script as the parent script and it configures the defaults as well as the various checkboxes and edit boxes on the different tabs within the dialog, then as the last call in the script, I invoke the AutoHotkey script to set the device volume and mute values. Also, in the AutoHotkey script I use two libraries, the VA (Vista Audio) library and the COM library, which can be found through the AutoHotkey forums. Take a look at the Scripts & Functions forum under the title "Vista Audio Control Functions v2.0" to determine how to add these libraries to AutoHotkey. I am going to include two code blocks, one for the AutoHotkey script and one for the AutoIt script. You will probably have plenty of better ways to write these scripts, because when I started this in December I was a novice to these languages, and I have been in and out of this scripting project over the last month as I have been working on other aspects of our project. Anyhow, good luck, I hope this solves some of your problems out there.

The first script is the AutoHotkey script called DevicesSet.ahk:

#NoEnv

COM_CoInitialize()
VA_SetVolume(100.0,1,1,"Stereo Mix:1")
VA_SetVolume(100.0,1,2,"Stereo Mix:1")
VA_SetMute(0,1,"Stereo Mix:1")

;Loop to find the microphone capture device
i := 1
notFound := true
Loop
{
  if (notFound = false)
    break ;Terminate the loop

 ;Get the device name
  device_desc := "capture:" . i
  device := VA_GetDevice(device_desc)
  device_name := VA_GetDeviceName(device)

 ;Compare the device name for loop termination
  if (device_name == "Microphone (Realtek High Definition Audio)")
    notFound := false
  else
    i := i+1
}

VA_SetVolume(100.0,1,1,device_desc)
VA_SetVolume(100.0,1,2,device_desc)
VA_SetMute(0,1,device_desc)
COM_CoUninitialize()

The second script is the AutoIt script called SoundCfg.au3:

; Script Start - Add your code below here
#include <GuiSlider.au3>
#include <GuiButton.au3>

;*********************************************
Func SetPlaybackDefault($spk)
    
    Dim $itemCount
    $itemCount = ControlListView("Sound", "", "SysListView321", "GetItemCount")
;Loop through items to find speakers
    For $i = 0 to $itemCount - 1
    ;Select the item
        ControlListView("Sound", "", "SysListView321", "Select", $i)
        Opt("WinWaitDelay", 1000)
        WinWait("Sound")
        
    ;Click the properties button to open the dialog and see if it is the speakers
        ControlClick("Sound", "", 1003)
        Opt("WinWaitDelay", 1000)
        WinWait("[CLASS:#32770]")
    
        Dim $var
    ;Get the string in the editbox
        $var = ControlGetText("[CLASS:#32770]", "", 1201)
        If $var == $spk Then
        ;Click Cancel to close the dialog
            ControlClick("[CLASS:#32770]", "", 2)
            Opt("WinWaitDelay", 1000)
            WinWait("Sound")
        ;Click the default button to set speakers as default
            ControlClick("Sound", "", 1002)
            Opt("WinWaitDelay", 1000)
            WinWait("Sound")
            ExitLoop
        Else
        ;Click Cancel to close the dialog
            ControlClick("[CLASS:#32770]", "", 2)
            Opt("WinWaitDelay", 1000)
            WinWait("Sound")
        EndIf
    Next
    
;Move back to top
    ControlListView("Sound", "", "SysListView321", "Select", 0)
    Opt("WinWaitDelay", 1000)
    WinWait("Sound")
EndFunc
;*********************************************

;*********************************************
Func _ExplainState($iState, $fPushButton = False)
    Local $sText = ""
    If Not $fPushButton And Not $iState Then Return _
            @CRLF & "Indicates the button is cleared. Same as a return value of zero." & @CRLF
    If BitAND($iState, $BST_CHECKED) = $BST_CHECKED Then _
            $sText &= @CRLF & "Indicates the button is checked." & @CRLF
    If BitAND($iState, $BST_FOCUS) = $BST_FOCUS Then _
            $sText &= @CRLF & "Specifies the focus state. A nonzero value indicates that the button has the keyboard focus." & @CRLF
    If BitAND($iState, $BST_INDETERMINATE) = $BST_INDETERMINATE Then _
            $sText &= @CRLF & "Indicates the button is grayed because the state of the button is indeterminate." & @CRLF
    If $fPushButton Then
        If BitAND($iState, $BST_PUSHED) = $BST_PUSHED Then
            $sText &= @CRLF & "Specifies the highlight state." & @CRLF
        Else
            $sText &= @CRLF & "Specifies not highlighted state." & @CRLF
        EndIf
    EndIf
    Return $sText
EndFunc  ;==>_ExplainState
;*********************************************

;*********************************************
Func ConfigureHeadsetEarphone() 
;Go to the Levels tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")
    
;Slider with its value in text and the Mute button are set
;in the AutoHotKey script call at the end of this script  
    
;Set the Static text value
;ControlSetText("[CLASS:#32770]", "", 1522, "100")
;Opt("WinWaitDelay", 1000)
;WinWait("[CLASS:#32770]")
    
;Set the Slider value
;$hWin = WinGetHandle("[CLASS:#32770; INSTANCE:1]")
;;ConsoleWrite("Debug: $hWin = " & $hWin & @LF)
;$hSlider = ControlGetHandle($hWin, "", "[CLASS:msctls_trackbar32;INSTANCE:1]")
;;ConsoleWrite("Debug: $hSlider = " & $hSlider & @LF)
;_GUICtrlSlider_SetPos($hSlider, 100)
;Opt("WinWaitDelay", 1000)
;WinWait("[CLASS:#32770]")
;$iData = _GUICtrlSlider_GetPos($hSlider)
   ;ToolTip("$iData = " & $iData)
;Opt("WinWaitDelay", 1000)
;WinWait("[CLASS:#32770]")
    
;Set the Mute button
    
;Get the Mute button status
;$hMuteButton = ControlGetHandle($hWin, "", "[CLASS:Button;INSTANCE:5]")    
;MsgBox(33, "ButtonState", "Mute Button: " & _ExplainState(_GUICtrlButton_GetState($hMuteButton)))

;Go to the Advanced tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")
;Set the dropdown selection
    ControlCommand("[CLASS:#32770]", "", 1410, "SelectString", "2 channel, 16 bit, 44100 Hz (CD Quality)")
;Uncheck the first checkbox
    ControlCommand("[CLASS:#32770]", "Allow applications to take exclusive control of this device", 1411, "UnCheck", "")

;Click the Ok button
    ControlClick("[CLASS:#32770]", "", 1)
    Opt("WinWaitDelay", 1000)
    WinWait("Sound")    
EndFunc
;*********************************************

;*********************************************
Func ConfigureSpeakers()
;Go to the Levels tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")

;Go to the Enhancements tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")
;Uncheck the sound effects checkbox
    ControlCommand("[CLASS:#32770]", "Disable all sound effects", 5000, "UnCheck", "")
;Uncheck the immediate mode checkbox
    ControlCommand("[CLASS:#32770]", "Immediate mode", 248, "UnCheck", "")

;Go to the Advanced tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")   
;Set the dropdown selection
    ControlCommand("[CLASS:#32770]", "", 1410, "SelectString", "16 bit, 44100 Hz (CD Quality)")
;Uncheck the first checkbox
    ControlCommand("[CLASS:#32770]", "Allow applications to take exclusive control of this device", 1411, "UnCheck", "")

;Click the Ok button
    ControlClick("[CLASS:#32770]", "", 1)
    Opt("WinWaitDelay", 1000)
    WinWait("Sound")
EndFunc
;*********************************************

;*********************************************
Func ConfigureHDAudio2ndOutput()
;Go to the Levels tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")

;Go to the Enhancements tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")
;Uncheck the sound effects checkbox
    ControlCommand("[CLASS:#32770]", "Disable all sound effects", 5000, "UnCheck", "")
;Uncheck the immediate mode checkbox
    ControlCommand("[CLASS:#32770]", "Immediate mode", 248, "UnCheck", "")

;Go to the Advanced tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")
;Send("{DOWN}")
;Set the dropdown selection
    ControlCommand("[CLASS:#32770]", "", 1410, "SelectString", "2 channel, 16 bit, 44100 Hz (CD Quality)")
;Uncheck the first checkbox
    ControlCommand("[CLASS:#32770]", "Allow applications to take exclusive control of this device", 1411, "UnCheck", "")

;Click the Ok button
    ControlClick("[CLASS:#32770]", "", 1)
    Opt("WinWaitDelay", 1000)
    WinWait("Sound")
EndFunc
;*********************************************

;*********************************************
Func SetPlaybackDeviceConfig()
    
    Dim $itemCount
    $itemCount = ControlListView("Sound", "", "SysListView321", "GetItemCount")
;Loop through items to configure the devices
    For $i = 0 to $itemCount - 1
    ;Select the item
        ControlListView("Sound", "", "SysListView321", "Select", $i)
        Opt("WinWaitDelay", 1000)
        WinWait("Sound")
        
    ;Click the properties button to open the dialog and determine the device
        ControlClick("Sound", "", 1003)
        Opt("WinWaitDelay", 1000)
        WinWait("[CLASS:#32770]")
    
        Dim $var
    ;Get the string in the editbox
        $var = ControlGetText("[CLASS:#32770]", "", 1201)
        Switch $var
        Case "Headset Earphone"
            ConfigureHeadsetEarphone()
        Case "Speakers"
            ConfigureSpeakers()
        Case "Realtek HD Audio 2nd output"
            ConfigureHDAudio2ndOutput()
        Case "Realtek Digital Output"
        ;Click Cancel to close the dialog
            ControlClick("[CLASS:#32770]", "", 2)
            Opt("WinWaitDelay", 1000)
            WinWait("Sound")
        Case Else
        ;Click Cancel to close the dialog
            ControlClick("[CLASS:#32770]", "", 2)
            Opt("WinWaitDelay", 1000)
            WinWait("Sound")
        EndSwitch
    Next
EndFunc
;*********************************************

;*********************************************
Func SetRecordingDefault($aux, $cd)
    
    Dim $itemCount
    $itemCount = ControlListView("Sound", "", "SysListView321", "GetItemCount")
;Loop through items to find Aux or CD Audio
    For $i = 0 to $itemCount - 1
    ;Select the item
        ControlListView("Sound", "", "SysListView321", "Select", $i)
        Opt("WinWaitDelay", 1000)
        WinWait("Sound")
        
    ;Click the properties button to open the dialog and see if it is the Aux or CD Audio
        ControlClick("Sound", "", 1003)
        Opt("WinWaitDelay", 1000)
        WinWait("[CLASS:#32770]")
    
        Dim $var
    ;Get the string in the editbox
        $var = ControlGetText("[CLASS:#32770]", "", 1201)
        If ($var == $aux) OR ($var == $cd) Then
        ;Click Cancel to close the dialog
            ControlClick("[CLASS:#32770]", "", 2)
            Opt("WinWaitDelay", 1000)
            WinWait("Sound")
        ;Click the default button to set Aux or CD Audio as default
            ControlClick("Sound", "", 1002)
            Opt("WinWaitDelay", 1000)
            WinWait("Sound")
            ExitLoop
        Else
        ;Click Cancel to close the dialog
            ControlClick("[CLASS:#32770]", "", 2)
            Opt("WinWaitDelay", 1000)
            WinWait("Sound")
        EndIf
    Next
    
;Move back to top
    ControlListView("Sound", "", "SysListView321", "Select", 0)
    Opt("WinWaitDelay", 1000)
    WinWait("Sound")
EndFunc
;*********************************************

;*********************************************
Func ConfigureHeadsetMicrophone()
;Go to the Levels tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")

;Go to the Advanced tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")
;Send("{DOWN}")
;Set the dropdown selection
    ControlCommand("[CLASS:#32770]", "", 1410, "SelectString", "1 channel, 16 bit, 44100 Hz (CD Quality)")
;Uncheck the first checkbox
    ControlCommand("[CLASS:#32770]", "Allow applications to take exclusive control of this device", 1411, "UnCheck", "")

;Click the Ok button
    ControlClick("[CLASS:#32770]", "", 1)
    Opt("WinWaitDelay", 1000)
    WinWait("Sound")
EndFunc
;*********************************************

;*********************************************
Func ConfigureMicrophone()
;Go to the Levels tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")

;Go to the Enhancements tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")
;Uncheck the sound effects checkbox
    ControlCommand("[CLASS:#32770]", "Disable all sound effects", 5000, "UnCheck", "")
;Uncheck the immediate mode checkbox
    ControlCommand("[CLASS:#32770]", "Immediate mode", 248, "UnCheck", "")

;Go to the Advanced tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")
;Send("{DOWN}")
;Set the dropdown selection
    ControlCommand("[CLASS:#32770]", "", 1410, "SelectString", "2 channel, 16 bit, 44100 Hz (CD Quality)")
;Uncheck the first checkbox
    ControlCommand("[CLASS:#32770]", "Allow applications to take exclusive control of this device", 1411, "UnCheck", "")

;Click the Ok button
    ControlClick("[CLASS:#32770]", "", 1)
    Opt("WinWaitDelay", 1000)
    WinWait("Sound")
EndFunc
;*********************************************

;*********************************************
Func ConfigureAux()
;Go to the Levels tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")
;Nothing to do here

;Go to the Enhancements tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")
;Nothing to do here

;Go to the Advanced tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")
;Send("{DOWN}")
;Set the dropdown selection
    ControlCommand("[CLASS:#32770]", "", 1410, "SelectString", "2 channel, 16 bit, 44100 Hz (CD Quality)")
;Uncheck the first checkbox
    ControlCommand("[CLASS:#32770]", "Allow applications to take exclusive control of this device", 1411, "UnCheck", "")

;Click the Ok button
    ControlClick("[CLASS:#32770]", "", 1)
    Opt("WinWaitDelay", 1000)
    WinWait("Sound")
EndFunc
;*********************************************

;*********************************************
Func ConfigureStereoMix()
;Go to the Levels tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")

;Go to the Enhancements tab
    Send("^{TAB}")
    Opt("WinWaitDelay", 1000)
    WinWait("[CLASS:#32770]")
;Uncheck the sound effects checkbox
    ControlCommand("[CLASS:#32770]", "Disable all sound effects", 5000, "UnCheck", "")
;Uncheck the immediate mode checkbox
    ControlCommand("[CLASS:#32770]", "Immediate mode", 248, "UnCheck", "")

;Click the Ok button
    ControlClick("[CLASS:#32770]", "", 1)
    Opt("WinWaitDelay", 1000)
    WinWait("Sound")
EndFunc
;*********************************************

;*********************************************
Func SetRecordingDeviceConfig()
    
    Dim $itemCount
    $itemCount = ControlListView("Sound", "", "SysListView321", "GetItemCount")
;Loop through items to configure the devices
    For $i = 0 to $itemCount - 1
    ;Select the item
        ControlListView("Sound", "", "SysListView321", "Select", $i)
        Opt("WinWaitDelay", 1000)
        WinWait("Sound")
        
    ;Click the properties button to open the dialog and determine the device
        ControlClick("Sound", "", 1003)
        Opt("WinWaitDelay", 1000)
        WinWait("[CLASS:#32770]")
    
        Dim $var
    ;Get the string in the editbox
        $var = ControlGetText("[CLASS:#32770]", "", 1201)
        Switch $var
        Case "Headset Microphone"
            ConfigureHeadsetMicrophone()
        Case "Microphone"
            ConfigureMicrophone()
        Case "Aux"
            ConfigureAux()
        Case "CD Audio"
            ConfigureAux()
        Case "Stereo Mix"
            ConfigureStereoMix()
        Case Else
        ;Click Cancel to close the dialog
            ControlClick("[CLASS:#32770]", "", 2)
            Opt("WinWaitDelay", 1000)
            WinWait("Sound")
        EndSwitch
    Next
EndFunc
;*********************************************

;*********************************************
;Show the sound dialog with the first tab (Playback) selected
Run("control mmsys.cpl,,0")
Opt("WinWaitDelay", 1000)
WinWait("Sound")
;*********************************************

;*********************************************
;Call the function to set the Playback default device
SetPlaybackDefault("Speakers")
;*********************************************

;*********************************************
;Call the function to set the Playback device configurations
SetPlaybackDeviceConfig()
;*********************************************

;*********************************************
;Move to next tab (Recording) in dialog
Send("^{TAB}")
Opt("WinWaitDelay", 1000)
WinWait("Sound")
;*********************************************

;*********************************************
;Call the function to set the Recording default device
SetRecordingDefault("Aux", "CD Audio")
;*********************************************

;*********************************************
;Call the function to set the Recording device configurations
SetRecordingDeviceConfig()
;*********************************************

;*********************************************
;Click the Ok button to close the dialog
ControlClick("Sound", "", 1)
;*********************************************

;*********************************************
;Run the AutoHotKey script to set the device volume and mute
Run("C:\Program Files\AutoHotkey\AutoHotkey.exe C:\AutoHotKey\DevicesSet\DevicesSet.ahk")
;*********************************************

That's all of it. Let me know if you have any questions and I'll se what I can do.


Gotta keep on truckin' to find the perfect solution, but sometimes you run into roadblocks, so you gotta jam right through those roadblocks!!

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  

×