Jump to content

Selecting a Value from a ComboBox


Guest MAxel
 Share

Recommended Posts

Hey there - I'm trying to use AutoIT to automate some regression tests but I running into difficulties getting the correct selection from a combo box:

this works:

ControlCommand("Mobile Asset Auditor Transmit", "OK", "ComboBox1", "ShowDropDown", "")

$choose = ControlCommand("Mobile Asset Auditor Transmit", "OK", "ComboBox1", "FindString", 'Network')

MsgBox(0, "Text searched was:", $choose)

ControlCommand("Mobile Asset Auditor Transmit", "OK", "ComboBox1", "SetCurrentSelection", $choose)

MsgBox(0, "Text found was:", $choose)

sleep(5000)

ControlClick("Mobile Asset Auditor Transmit:", "OK", "Button3")

Send("{ENTER}")

but when I comment out the two msgbox lines, it doesn't.

Any help would be greatly appreciated

MAxel

(any sufficiently advanced technology is indistinguishable from magic . . . Arthur C Clarke)

Link to comment
Share on other sites

Try adding a Sleep command after each MsgBox line.  This will help  to prevent the script from running too fast after the MsgBox lines are commented/removed. You may need to tweak the values, but 500 should be a safe bet.

<{POST_SNAPBACK}>

Thanks a lot for the suggestion - but it doesn't seem to work. I upped the (sleep)values to 5000 but without the MsgBox lines the first value is always selected instead
Link to comment
Share on other sites

It could be a focus issue.

try MsgBox(0, "Text searched was:", $choose,1) ; timeout 1 sec

or put this where msgboxes are:

ControlFocus ( "Mobile Asset Auditor Transmit", "OK", "ComboBox1")

or you might want to set your focus to a different control.

Hard for me to test...

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

It could be a focus issue.

try MsgBox(0, "Text searched was:", $choose,1) ; timeout 1 sec

or put this where msgboxes are:

ControlFocus ( "Mobile Asset Auditor Transmit", "OK", "ComboBox1")

or you might want to set your focus to a different control.

Hard for me to test...

<{POST_SNAPBACK}>

Thanks a lot

the MsgBox(0, "Text searched was:", $choose,1) works fine

(not pretty - but we're talking automated regression so 'pretty' isn't a major issue)

the ControlFocus ( "Mobile Asset Auditor Transmit", "OK", "ComboBox1") doesn't seem to do the job.

again, many thanks !

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...