Home > Language Reference > Web Functions > WriteHTMLPaste

WriteHTMLPaste

The WriteHTMLPaste function writes text in a text field web-form, pasting the characters all at once.

Usage

Used to fill a big text field in just one paste. Use too WriteHTMLPaste if the text to type contains special characted such as a <.

VideoWriteHTML writes some text into a field within a web form. WriteHTMLEncrypted and WriteHTMLPaste are variations and the video explains the use of those three WinTask functions.

Syntax

ret=WriteHTMLPaste(<html_descriptor> , <text> [, delete])

Parameters

<html_descriptor>, string, HTML descriptor of the text field. 

<text>, string, text to write in the form field. <text> is pasted at the end of any existing text in the field unless delete keyword is specified.

delete, optional keyword. Deletes the content of the field before pasting <text>.

Return value

Ret, optional numeric return value. If the function succeeds writing within 30 seconds (this default value can be changed using #ActionTimeout), the function returns 0. If the function fails, the return value is a nonzero negative value (see Web Functions Error Codes).

Remarks

Use Recording mode to generate a WriteHTML statement, then change WriteHTML function to WriteHTMLPaste.

If at replay, you see that the text is not typed correctly, slow down the field filling using #HTMLPosRetry.

See also

WriteHTML
WriteHTMLEncrypted

Examples

'On the demonstration WinTask Web site, click the Form link and then fill the form.
'The Pause lines are added to demonstrate how WriteHTMLPaste works.
StartBrowser("IE", "www.wintask.com/demos")
UsePage("WinTask Demonstration Pages")
ClickHTMLElement("A[INNERTEXT= 'Form']")
UsePage("Form")
WriteHTML("INPUT TEXT[NAME= 'company']", "My Company")
pause 1
WriteHTMLPaste("INPUT TEXT[NAME= 'company']", "My Other Company")
pause 1
WriteHTMLPaste("INPUT TEXT[NAME= 'company']", "My Company",delete)
ClickHTMLElement("INPUT RESET[VALUE= 'Clear']")
CloseBrowser()

'On the demonstration WinTask Web site loaded in Firefox, click the Form link and then fill the form.
'The Pause lines are added to demonstrate how WriteHTMLPaste works.
StartBrowser("FF", "www.wintask.com/demos")
UsePage("WinTask Demonstration Pages")
ClickHTMLElement("A[INNERTEXT= 'Form']")
UsePage("Form")
WriteHTML("INPUT TEXT[NAME= 'company']", "My Company")
pause 1
WriteHTMLPaste("INPUT TEXT[NAME= 'company']", "My Other Company")
pause 1
WriteHTMLPaste("INPUT TEXT[NAME= 'company']", "My Company",delete)
ClickHTMLElement("INPUT RESET[VALUE= 'Clear']")
CloseBrowser()


'On the demonstration WinTask Web site loaded in Chrome, click the Form link and then fill the form.
'The Pause lines are added to demonstrate how WriteHTMLPaste works.
StartBrowser("CH", "www.wintask.com/demos")
UsePage("WinTask Demonstration Pages")
ClickHTMLElement("A[INNERTEXT= 'Form']")
UsePage("Form")
WriteHTML("INPUT TEXT[NAME= 'company']", "My Company")
pause 1
WriteHTMLPaste("INPUT TEXT[NAME= 'company']", "My Other Company")
pause 1
WriteHTMLPaste("INPUT TEXT[NAME= 'company']", "My Company",delete)
ClickHTMLElement("INPUT RESET[VALUE= 'Clear']")
CloseBrowser()