SelectedHTMLItem$
Web function.
The SelectedHTMLItem$ function returns the item selected in the specified combobox/listbox HTML element. Not available in WinTask Lite.
Usage
Used to retrieve what the user has selected in a combo or listbox in a web form for example.
Syntax
var$=SelectedHTMLItem$(<html_descriptor>)
Parameters
<html_descriptor>, unique identifier for the HTML combobox/listbox to retrieve the information from. Use Recording mode for generating automatically the html descriptor.
Return value
var$ returns what has been selected by the user in the specified html combobox/listbox. If the combo/listbox is not found within the web page specified by a previous UsePage, var$ is empty.
Remarks
See the second example below to ensure that the HTML combo/list is fully loaded before invoking SelectedHTMLItem$ function.
Examples
On WinTask Web site, we test what the user has selected in the Contact Us form:
StartBrowser("IE", "www.wintask.com")
UsePage("WinTask - Automation software and Task Scheduler. Macro software with Macro Recorder")
ClickHTMLElement("A[INNERTEXT= 'Contact Us']")
UsePage("WinTask Contact Us")
'The SelectHTMLItem waits for #ActionTimeout that the listbox is fully loaded.
SelectHTMLItem("SELECT[NAME= 'topic']", "Future Enhancement")
ClickHTMLElement("INPUT CHECKBOX[NAME= 'contactsoon']")
selection$=SelectedHTMLItem$("SELECT[NAME= 'topic']")
msgbox(selection$) 'Displays Future Enhancement
CloseBrowser()
On WinTask Web site, synchronization tips : we suppose that all the pages have the same title WinTask,
and we want to retrieve what is per default in Subject fieldStartBrowser("IE", "www.wintask.com")
UsePage("WinTask")
ClickHTMLElement("A[INNERTEXT= 'Contact Us']")
'If the new page has the same title as the previous one, the Recording mode does not generate a UsePage,
'so add it manually as below, execution of the UsePage line will finish only when all the HTML elements
'on the new web page are loaded.
UsePage("WinTask")selection$=SelectedHTMLItem$("SELECT[NAME= 'topic']")
msgbox(selection$) 'Displays WinTask (the default value)
CloseBrowser()