GetHTMLEditText
Capture function, Web function.
The GetHTMLEditText function captures the content of an HTML Edit field within a Web form.
Usage
Used for retrieving data displayed in a field of a Web form. To know the HTML descriptor of the field where the data has to be captured, use Recording mode and record some typing in this field.
Syntax
ret=GetHTMLEditText(<html_descriptor>,var$)
Parameters
<html_descriptor>, unique identifier for the HTML element INPUT field from which the text has to be captured. See HTML descriptor for HTML tags identification. Use Recording mode to generate automatically this HTML descriptor by just typing some data in the field.
<var$>, string, captured text.
Return value
Ret, numeric return code. When successful, the function returns 0, otherwise use this return code for Error Handling.
Remarks
GetHTMLEditText does not include any synchronization; a UsePage must be used before to be sure that the content of the field to capture is already displayed.
Examples
StartBrowser("IE", "www.yahoo.com")
UsePage("Yahoo!")
WriteHTML("INPUT TEXT[NAME= 'p']", "WinTask")
pause 2
UsePage("Yahoo!")
ret = GetHTMLEditText("INPUT TEXT[NAME= 'p']",var$)
msgbox(var$) 'var$ contains the data typed in the Search field of yahoo page, so var$ contains WinTaskCloseBrowser()
'A second example on the demonstration pages of wintask web site, note the capture of the content of a TextArea field
StartBrowser("IE", "www.wintask.com/demos")
UsePage("WinTask Demonstration Pages")
ClickHTMLElement("A[INNERTEXT= 'Form']")
UsePage("Form")
WriteHTML("TEXTAREA[NAME= 'message']", "bla bla bli")
SelectHTMLItem("SELECT[NAME= 'subject']", "Web site")
ret=gethtmledittext("TEXTAREA[NAME= 'message']",var$)
msgbox(var$)
WriteHTML("INPUT TEXT[NAME= 'name']", "Test")
WriteHTML("INPUT TEXT[NAME= 'email']", "test@test.com")
ret=gethtmledittext("INPUT TEXT[NAME= 'email']",var$)
msgbox(var$)
ClickHTMLElement("INPUT RESET[VALUE= 'Clear']")
CloseBrowser()
'Same example on the demonstration pages of wintask web site, using Firefox.
StartBrowser("FF", "www.wintask.com/demos")
UsePage("WinTask Demonstration Pages")
ClickHTMLElement("A[INNERTEXT= 'Form']")
UsePage("Form")
WriteHTML("TEXTAREA[NAME= 'message']", "bla bla bli")
SelectHTMLItem("SELECT[NAME= 'subject']", "Web site")
ret=gethtmledittext("TEXTAREA[NAME= 'message']",var$)
msgbox(var$)
WriteHTML("INPUT TEXT[NAME= 'name']", "Test")
WriteHTML("INPUT TEXT[NAME= 'email']", "test@test.com")
Gethtmledittext("INPUT TEXT[NAME= 'email']",var$)
msgbox(var$)
ClickHTMLElement("INPUT RESET[VALUE= 'Clear']")
CloseBrowser())