Hallo,
ich bin der Uwe, 55 Jahre alt und habe keine Erfahrung was Programmierung, Skripte etc betrifft. Ich möchte mit AutoIt in einer DropDown Liste eigentlich einfach nur einen Eintrag auswählen. Eigentlich ...
Ich bin mit Windows 10 unterwegs und möchte in der Soundeinstellung unter Aufnahme beim Realtek Stereomix (Bild 1) eine Quelle auswählen. Nach langem Suchen und Lesen habe ich in einem Forum ein Skript gefunden und dies mit Trial und Error versucht an meine Bedürfnisse an zu passen.
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.14.5
Author: myName
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
#include <GuiSlider.au3>
#include <GuiButton.au3>
;*********************************************
Func ConfigureStereoMix()
Opt("WinWaitDelay", 1000)
WinWait("[CLASS:#32770]")
Send("^{TAB}")
Opt("WinWaitDelay", 1000)
WinWait("[CLASS:#32770]")
;Opt("WinWaitDelay", 1000)
;ControlCommand("[CLASS:#32770]", "Dieses Gerät als Wiedergabequelle verwenden", 1601, "Check", "") HIER WIEDER AKTIVIEREN !!!!!
Opt("WinWaitDelay", 1000)
WinWait("[CLASS:#32770]")
;WinActivate("[TITLE:Eigenschaften von Stereomix]", "")
;$index = ControlCommand("[CLASS:#32770]", "", 1600, "FindString", "Lautsprecher (GameDAC Game)")
;ControlCommand ("[CLASS:#32770]", "", 1600, "ShowDropDown", "")
;Opt("WinWaitDelay", 50000)
;$test = ControlCommand("Eigenschaften von Stereomix", "", "[CLASS:ComboBox; INSTANCE:1]", "SelectString", "Lautsprecher (GameDAC Game)")
;msgbox(0, "test", $test)
ControlCommand ("[CLASS:ComboBox]", "", 1600, "SelectString", "Lautsprecher")
;ControlCommand ("[CLASS:#32770]", "", 1600, "SelectString", "Lautsprecher (GameDAC Game)")
;ControlCommand ("[CLASS:ComboBox; INSTANCE:1]", "", 1600, "SelectString", "Lautsprecher (GameDAC Game)")
;ControlCommand ( "Eigenschaften von Stereomix", "", 1600, "SelectString", "Lautsprecher (GameDAC Game)")
;ControlCommand("[CLASS:#32770]", "", 1600, "SetCurrentSelection", 2);ComboBox1
;$hWnd = WinWaitActive("Eigenschaften von Stereomix", "")
;ControlCommand($hWnd, "", "[CLASS:ComboBox; INSTANCE:1]", "SelectString", "Lautsprecher (GameDAC Game)")
Opt("WinWaitDelay", 50000)
Send("^{TAB}")
Opt("WinWaitDelay", 1000)
WinWait("[CLASS:#32770]")
Send("^{TAB}")
Opt("WinWaitDelay", 1000)
WinWait("[CLASS:#32770]")
Send("^{TAB}")
Opt("WinWaitDelay", 1000)
WinWait("[CLASS:#32770]")
ControlCommand("[CLASS:#32770]", "", 1410, "SelectString", "2 Kanal, 16 Bit, 44100 Hz (CD-Qualität)")
;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 "Stereomix"
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")
;*********************************************
;*********************************************
;Move to next tab (Recording) in dialog
Send("^{TAB}")
Opt("WinWaitDelay", 1000)
WinWait("Sound")
;*********************************************
;*********************************************
;Call the function to set the Recording device configurations
SetRecordingDeviceConfig()
;*********************************************
;*********************************************
;Click the Ok button to close the dialog
ControlClick("Sound", "", 1)
;*********************************************
Alles anzeigen
Checkbox setzen und einen Eintrag in einer anderen DropDown Liste (Bild 3) auswählen klappt wunderbar, nur in dieser DropDown Liste (Bild 2) will es einfach nicht klappen. Es wird nichts ausgewählt bzw. gesetzt. Ich bin ratlos und könnte etwas Hilfe gebrauchen.
Laut AutoIt Window Info unterscheiden sich beide Listen nur in der ID. Liste die nicht klappt hat die ID 1600 (Bild 1a) und die Liste die klappt hat die ID 1410 (Bild 3a). Sonst kann ich keine Unterschiede finden. Wie im Quellcode zu sehen ist, habe ich mehrere Sachen ausprobiert. Sorry, ich weiß nicht weiter.
Mit freundlichen Grüssen
Uwe