Jump to content
Sign in to follow this  
Guest MAxel

Selecting a Value from a ComboBox

Recommended Posts

Guest MAxel

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)

Share this post


Link to post
Share on other sites
Bartokv

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.

Share this post


Link to post
Share on other sites
Guest MAxel

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

Share this post


Link to post
Share on other sites
scriptkitty

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.

Share this post


Link to post
Share on other sites
Guest MAxel

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 !

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  

×