Greetings,
I am going to make an assumption here that you are talking about an "HTML"
dropdown as opposed to Flash or something else type dropdown - let me know
if you have to address something along these lines - the approach needed may
be different.
Below is an example script that illustrates finding a particular item in a
list. I made the "part that does the selecting" a generic sub routine so you
could reuse it to find other items at will. (This will also be posted to the
script center on Monday).
To use this code, first have a Pause command for the dropdown. This is very
important; reason being is that the Pause sets Web.Selected to the dropdown
- without the pause, this will not work!
The loop then scans through available dropdown options until it finds and
sets the dropdown to the one you are looking for.
Here's the example - say you wanted to shop for Toys on Amazon.com, you'd
use the following:
Sub test()
Connect "", stWeb
Go_ "amazon.com"
'Here's my Pause for the dropdown
Pause " All ProductsBooksPopular Musi*<SELECT>[EMAIL PROTECTED]: Welcome"
GetListItem "Toys"
Click "Go<INPUT>[EMAIL PROTECTED]: Welcome"
End Sub
'Here's the part that really does the work
Sub GetListItem(ItemName As String)
Set e = Web.Selected
For i = 0 To e.options.length
If ItemName = e.options(i).innerHTML Then
e.selectedIndex = i
'The Go command is optional - use if the act of selecting an item is
'designed to navigate to another page, do not use if you are just selecting
'a value and clicking on a button or similar
'Go_ e.options(i).Value
Exit Sub
End If
Next i
End Sub
Hope this helps - any questions?
Regards and happy scripting!
Thom
Thom C. Blackwell
Product Manager
Boston Software Systems
866.653.5105