Jump to content
Sign in to follow this  

Issue using ControlCommand ("SelectString") in a ListBox

Recommended Posts


Hi all,

I am trying to automate a web page using the ControlCommand Autoit API.

Using the AutoIt Window Info utility, I can get the Class name and Windows name of the control on the web page, and in other pages the standard usage of ControlCommand with the option "SelectString"), works fine.

Unfortunately, on a specific web page even though I can detect Window Name and Control name, my Automation does not work.

Actually, I would like to selecte in a ComboBox a specif item : that all !.

I want to point out what the ControlCommand help says :



Some controls will resist automation unless they are the active window. Use the WinActive() function to force the control's window to the top before using ControlCommand() on these controls.

Certain commands that work on normal Combo and ListBoxes do not work on "ComboLBox" controls.


.. and very sadly I must say that SOME item in the ComboBox are ComboLBox controls ...

Anybody faced this issue already ?

I have also tried to use the UDF for IEManagment but I get lost because this CRM uses many Frames and Forms containing controls and it is not so easy navigate the page ... Also some JAVA scripts make difficult even to edit the page in html ...

That why I preferred to use the standard way as follow :

AutoIt script used :



$WndName = 0

$ComboBoxName = 0

$ItemToSelect = 0


$WndName = $CmdLine[1]

$ComboBoxName = $CmdLine[2]

$ItemToSelect = $CmdLine[3]


$rc = 0


WinActivate ($WndName)

$rc = ControlCommand ($WndName, "", $ComboBoxName, "IsEnabled", "")


If $rc = 1 Then

ControlFocus($WndName, "", $ComboBoxName)

ControlCommand ($WndName, "", $ComboBoxName, "SelectString", $ItemToSelect)

if @error = 1 then

exit (0)


exit (1)




exit 1

Any Idea ? Suggestions ???

Ciao !



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