Jump to content

Drop Down List Selection?


Recommended Posts

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.

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

 

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

 

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

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.

 

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

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

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

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...