2016-04-11 2 views
1

Ich automatisiere Windows-Anwendung mit AutoIT.Als Teil dieser ich versuchte, Wert aus Drop-down zu wählen, aber ich kann den Wert nicht auswählen. Unten ist mein Code.AutoIT - So wählen Sie Wert aus Drop-Down (Combobox)

ControlCommand("Database Select","", "[Name:db_comboBox]", "ShowDropDown") ControlCommand("DatabaseSelect","","Name:db_comboBox]","SelectString",'Test') ControlCommand("Database Select","Main Load Settings", "[Name:db_comboBox]", "HideDropDown")

Kann mir jemand helfen, wie Wert von Dropdown-Liste zu wählen.

Antwort

1

Milos, Vielen Dank für Ihre Hilfe und den Code unten gelöst mein Fall.

ControlClick("Database Select", "", "[Name:db_comboBox]") 
    While 1 
    Send("{DOWN}") 
    $ctext=ControlGetText("Database Select","","[Name:db_comboBox]") 
    If $ctext="DB_UKTEST" Then 
     ExitLoop 
    EndIf 
    WEnd 
1

Beispielcode für die Auswahl des Werts im Dropdown-Menü.

Run("calc.exe") 

WinWait("Calculator") 

$CALC = WinGetHandle("Calculator") 

ControlSend($CALC, "", "[INSTANCE:1]", "^u") 
WinActivate($CALC) 

$index = ControlCommand($CALC,"Find String","[CLASS:ComboBox; INSTANCE:1]","FindString",'Volume') 
ControlCommand($CALC, "", "[CLASS:ComboBox; INSTANCE:1]", "SetCurrentSelection", $index) 

Wenn an Ihrem Code angewendet:

$index = ControlCommand("Database Select","", "[Name:db_comboBox]","FindString",'Test') 
ControlCommand("Database Select","", "[Name:db_comboBox]", "SetCurrentSelection", $index) 
+0

Hallo Milos, Danke für die Antwort, aber meine Frage Wählen Sie einen Eintrag aus der Dropdown-Liste, der Befehl 'ControlListView' funktioniert nicht für mein Szenario. – SeJaPy

1

Dieser arbeitete für mich Control ("Drucken", "", "ComboBox1", "[Name: Microsoft PDF Drucken]")

Verwandte Themen