Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter FifteenWindows/OS Functions (continued)

ClipboardGetHTML Function

Overview

The ClipboardGetHTML function retrieves raw HTML text from the clipboard, if available.

Syntax/Parameters

Syntax

string = ClipboardGetHTML ( [handle hClipboard], [int mode] );

Parameters

hClipboard

An optional handle specifying an open Clipboard Object. If a handle is not specified, or specified as NULL_HANDLE, the default clipboard is open. If a Clipboard Object is open, it is automatically selected, and, if no object is open, a new object is opened and then closed upon completion of the function.

mode

An optional int specifying what to return from the clipboard. See Remarks below. The default value is CB_GET_HTML_RAW.

Return Value

Returns a string containing raw HTML from the clipboard or an empty string on failure. Use the GetLastError function to retrieve error information.

Remarks

The ClipboardGetHTML can return very large strings that may exceed the limit of many string functions. In addition, it can take a significant amount of time for certain applications to render various clipboard formats. Calling this function could result in what appears to be the application hanging while Windows retrieves the data.

There are four modes that can be used:

CB_GET_HTML_RAW — Return complete HTML image from clipboard with control prefix. This is the default mode.

CB_GET_HTML_COMPLETE — Returns the entire HTML as specified by the control prefix.

CB_GET_HTML_FRAGMENT — Returns the fragment of the HTML as specified by the control prefix.

CB_GET_HTML_SELECTION — Returns the select that loaded the HTML as specified by the control prefix.

In raw mode, a control prefix will precede the HTML data and the HTML data will normally contain marked segments for the heading, footing, and select components. It is up to the script to determine which segments are relevant. The following is an example of the header:

Version:1.0

StartHTML:000000274

EndHTML:000030189

StartFragment:000029905

EndFragment:000030105

StartSelection:000029905

EndSelection:000030105

SourceURL:http://www.zzz.co.uk/finance/

<!doctype html>

<html>

     ...

 

HTML coding posted on the clipboard will vary widely depending on the source application, the nature of the document, and the selected area that was copied. Some applications, such as MS Word, only render HTML to the clipboard upon request. This can result in a delay as the related application converts and posts the requested data. It also means that getting various segments and modes may be rather slow if there is a large amount of source data.

The other modes essentially pull the code from the data as specified by the control prefix.

Note that if the ClipboardGetHTML function returns an empty string it could mean that an application posted an empty table to the clipboard.

Related Functions 

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic