ListHTMLItem$
Web function.
The ListHTMLItem$ function returns the specified item from the specified HTML listbox or combobox.
Usage
Extracts the text contents of an item in a listbox or combobox displayed on a Web page. If the list/combo is a non-HTML plugin, ListHTMLItem$ function will not recognize the list, and you can use Clipboard:
SendKeys("<Ctrl C">) to copy the text to Clipboard (use Down key if you need to select a different item than the one selected), and GetClipboard$ function to retrieve the content of Clipboard.Syntax
var$=ListHTMLItem$(<HTML_descriptor>,<n>)
Parameters
<HTML_descriptor>, string, HTML descriptor of the listbox or combobox in which to find the <n>th item. First item starts at 0.
Return value
var$, string, return value which contains the <n>th item from the listbox or combobox. If the item does not exist, an empty string is returned.
Remarks
ListHTMLItem$ does not include any synchronization; a UsePage must be used before to be sure that the list to capture is ready.
Example
StartBrowser("IE", "www.wintask.com")
'Click Contact Us menu item on the left.
UsePage("WinTask - Automation software and Task Scheduler. Macro software with Macro Recorder")ClickHTMLElement("A[INNERTEXT= 'Contact Us']")
UsePage("WinTask Contact Us")
a$=ListHTMLItem$("SELECT[NAME= 'topic']", 3)
msgbox(a$)
Example code
This example demonstrates how ListHTMLItem can be used for retrieving all the items of an HTML list.
'The script launches google.com
'On the main page, it clicks the Advanced Search link,
'and on the next page extracts all the items for the list in the Language listitem.
dim tab_element$(1000)startbrowser("IE","www.google.com")
UsePage("Google")
ClickHTMLElement("A[INNERTEXT= 'Advanced Search']")
UsePage("Google Advanced Search")
i=0
repeat
a$=ListHTMLItem$("SELECT[NAME= 'lr']", i)
if ltrim$(rtrim$(a$))="" then
quit=1
else
tab_element$(i)=a$
i=i+1
endif
until quit=1
nb_item=i
i=0
repeat
mes$=mes$+"\n\"+tab_element$(i)
i=i+1
until i=nb_item
msgbox(mes$,64,"Number of items : "+str$(nb_item))