Search code examples
autoit

How to choose value from dropdown (combobox)?


I am automating a Windows application using AutoIt. I tried to select a value from a drop down menu, but I'm unable to. My code:

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

How to choose a value from dropdown?


Solution

  • Milos, Thanks for your help and the below code solved my case.

      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