Sign in to follow this  
Followers 0
pshankland

Drop Down List Selection?

10 posts in this topic

Hi all,

Am new to AutoIT so please be gentle!

I need to select some information from a drop down list and was wondering if someone could point me in the correct direction? The problem I have is that the list changes so can't use the options position as it may not be the same. So, I want to able to select XXX from the list each time no matter where in the list it appears.

Any suggestions?

Thanks.

Pete.

Share this post


Link to post
Share on other sites



Hi all,

Am new to AutoIT so please be gentle!

I need to select some information from a drop down list and was wondering if someone could point me in the correct direction? The problem I have is that the list changes so can't use the options position as it may not be the same. So, I want to able to select XXX from the list each time no matter where in the list it appears.

Any suggestions?

Thanks.

Pete.

I'm guessing this is for an external application, if so try ControlCommand


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

I'm guessing this is for an external application, if so try ControlCommand

Sorry, should have mentioned that the application I am using the drop down list within is Internet Explorer. I'll go off and look at the ControlCommand now.

Thanks.

Share this post


Link to post
Share on other sites

Sorry, should have mentioned that the application I am using the drop down list within is Internet Explorer. I'll go off and look at the ControlCommand now.

Thanks.

Not sure that will work with IE, you might want to check out the IE Management section in the User Defined Functions section of the help


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Cheers. Could you direct me to the IE Management section within the UDF help as I have looked and can't find it anywhere?

Thanks.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Cheers. Could you direct me to the IE Management section within the UDF help as I have looked and can't find it anywhere?

Thanks.

What version of AutoIt are you using?

Edit: had to look in both help files, it's in the 3.2.0.1 release and latest betas

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

What can I say - I am a total user!!!!

Thanks, found it :lmao:

Share this post


Link to post
Share on other sites

Couldn't find anything to select the drop down list so in the end did the following:

MouseClick("left", 155, 142); Click on the Model drop down list
Send('abc{enter}')  ; Find the first abc in the list and select

This was the simpliest way and seems to work well.

Thanks for the help.

Pete.

Share this post


Link to post
Share on other sites

Clicking on the drop down list and then typing the selection works if you use IE7. Unfortunatly, as I have just found out, this does NOT work for IE6 :lmao:

Can anyone suggest how I can select an option from a drop down list when the order the list is in will and can change?

thanks.

Pete.

Share this post


Link to post
Share on other sites

Clicking on the drop down list and then typing the selection works if you use IE7. Unfortunatly, as I have just found out, this does NOT work for IE6 :lmao:

Can anyone suggest how I can select an option from a drop down list when the order the list is in will and can change?

thanks.

Pete.

I find that using the keyboard from a known start point is reliable. eg. open the browser, tab a number of times until focus is on your dropdown, then down-key until you get where you want to go.

Another way, IF your page is formatted to use forms

;GET THE FORM NAME (form1 in this case)

$oForm = _IEFormGetObjByName ($oIE, "Form1")

;GET THE OBJECT NAME (AvailableResources in this case)

$oQuery = _IEGetObjByName ($oIE, "AvailableResources")

;MOVE FOCUS TO THE OBJECT

_IEAction ($oQuery, "focus")

;GET THE TEXT OF THE OBJECT

$oText = _IEFormElementGetObjByName ($oForm, "AvailableResources")

$Resource = _IEFormElementGetValue ($oText)

;IS THE TEXT EQUAL TO WHAT I WANT? ($group in this case)

$TEMP = (StringInStr($Resource, $Group))

;LOOP

While $TEMP=False And $prot<50

;DOWN

send("{DOWN}")

;WAIT

Sleep(70)

;CHECK AGAIN

$oText = _IEFormElementGetObjByName ($oForm, "AvailableResources")

$Resource = _IEFormElementGetValue ($oText)

$TEMP = (StringInStr($Resource, $Group))

;INCREMENT LOOP PROTECTION COUNTER

$Prot = $Prot + 1

WEnd

Hope that helps. I'm a noob in the IE field too.


The AutoIt help file should be interrogated.The Editor should be SciTe.The forums should have been searched.

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  
Followers 0