Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter FifteenWindows/OS Functions (continued)

15.8 OLE Automation

15.8.1 Overview

Object Linking and Embedding (OLE) is a technology developed by Microsoft that allows embedding and linking to documents and other objects. It also allows for automation and applications to act as servers for certain operations.

Legato supports basic interface as well as some Internet Explorer specific functions.

15.8.2 OLE Values and Data Types

OLE has a specific set of data types that are defined over and above conventional data types. Required types are dependent on the serving application.

Types are used both as parameter and return values. For parameters, Legato will automatically convert certain variable data types to OLE VT_ types. Return values are also converted. Others are not directly accessible.

  Windows SDK   Variant
Index
Parameter
Legato Type
Return
Legato Type
  Description  
  VT_ARRAY   8192   An array of values.  
  VT_BLOB   65   Length prefixed bytes  
  VT_BLOB_OBJECT   70   Blob contains an object  
  VT_BOOL   11 boolean boolean   Boolean value 0 for false or -1 for true. Incoming values are converted non-zero to -1.  
  VT_BSTR   8 string wstring   Pointer to a null-terminated Unicode string.  
  VT_BSTR_BLOB   4095   Reserved for system use  
  VT_BYREF   16384   By reference pointer.  
  VT_CARRAY   28   C style array of values.  
  VT_CF   71   Pointer to a Windows CLIPDATA structure, described above.  
  VT_CLSID   72   Pointer to a class identifier (CLSID) (or other Globally Unique Identifier (GUID)).  
  VT_CY   6   64-bit two’s complement integer (scaled by 10,000). This type is commonly used for currency amounts.  
  VT_DATE   7   A 64-bit floating point number representing the number of days (not seconds) since December 31, 1899. For example, January 1, 1900, is 2.0, January 2, 1900, is 3.0, and so on). This is stored in the same representation as VT_R8.  
  VT_DECIMAL   14   A Windows fixed DECIMAL structure.  
  VT_DISPATCH   9 handle handle   A Windows object (IDispatch type). As a parameter, this must be a valid OLE type object handle. For a return value, the handle created is a general OLE object that can be used in subsequent calls to OLE functions.  
  VT_EMPTY     See Remarks   A property with a type indicator of VT_EMPTY has no data associated with it; that is, the size of the value is zero.  
  VT_ERROR   10 dword   A 32-bit unsigned that contains a status code.  
  VT_FILETIME   64 qword   64-bit Windows FILETIME structure as defined by Win32. This translates to a 64-bit file time.  
  VT_HRESULT   25 dword   Standard 32-bit Windows return type.  
  VT_I1   16 char char   8-bit signed integer.  
  VT_I2   2 wchar short wchar short   16-bit signed integer.  
  VT_I4   3 int int   32-bit signed integer.  
  VT_I8   20 long long   64-bit signed integer.  
  VT_INT   22 int   32-bit signed integer value (equivalent to VT_I4).  
  VT_INT_PTR   37   Either a 4-byte or an 8-byte signed integer. The size of the integer is platform specific.  
  VT_LPSTR   30 string string   A pointer to a null-terminated ANSI string in the system default code page.  
  VT_LPWSTR   31 wstring wstring   A pointer to a null-terminated Unicode string in the user default locale.  
  VT_NULL   1   This is like a pointer to NULL.  
  VT_PTR   26   Pointer type.  
  VT_R4   4 float   32-bit floating point. Return value is converted to 64-bit float.  
  VT_R8   5 float float 64-bit floating point.
  VT_RECORD   36   User-defined type.  
  VT_SAFEARRAY   27   An array.  
  VT_STORAGE   67   A pointer to an IStorage interface.  
  VT_STORED_OBJECT   69   A pointer to an IStorage interface.  
  VT_STREAM   66   A pointer to an IStream interface.  
  VT_STREAMED_OBJECT   68   A pointer to an IStream interface.  
  VT_UI1   17 byte byte   8-bit unsigned integer.  
  VT_UI2   18 word word   16-bit unsigned integer.  
  VT_UI4   19 dword dword   32-bit unsigned integer.  
  VT_UI8   21 qword qword   64-bit unsigned integer.  
  VT_UINT   23 dword   4-byte unsigned integer (equivalent to VT_UI4).  
  VT_UINT_PTR   38   Either a 4-byte or an 8-byte unsigned integer. The size of the integer is platform specific.  
  VT_UNKNOWN   13   SDK IUnknown.  
  VT_USERDEFINED   29   Implementation/user-defined type.  
  VT_VARIANT   12   A DWORD type indicator followed by the corresponding value.  
  VT_VECTOR   4096   Simple counted array of values.  
  VT_VERSIONED_STREAM   73   Stream with a GUID version.  
  VT_VOID   24   C style void.  

Many OLE functions also require null parameters. Since this cannot be easily represented in Legato, a string constant, OLE_PARAM_EMPTY, has been defined with the content “{oleempty}”. This value can be used in place of a parameter or stored in a string data type.

Any OLE calls making contact with a server that exchange variant types will have the variant index stored in the last error buffer. Use the GetLastError function to retrieve the index value. Since return type mismatches can result in runtime errors, making a call to OLERunMethod or OLEGetProperty without capturing the return can allow the return type to be determined.

Return variants not understood by the processor are returned as boolean TRUE with the error message containing the variant type index.

15.8.3 Functions

General Functions:

OLEGetObject — Returns a handle to a specific OLE connection.

OLEGetProperty — Gets a specified property for an OLE object with a series of parameters.

OLEPutProperty — Set a specified property for an OLE object with a series of parameters.

OLERunMethod — Runs a specific OLE command with a series of parameters.

Internet Explorer:

OLEIEClose — Closes specified Internet Explorer application.

OLEIEGet — Loads a page using the ‘get’ verb within Internet Explorer.

OLEIEIsBusy — Checks to see if Internet Explorer is busy.

OLEIEPost — Loads a page using the ‘post’ verb within Internet Explorer.

OLEIEPostFile — Posts data within Internet Explorer using a specific field name.

OLEIERead — Reads the current page from an Internet Explorer instance.

OLEIEShow — Shows specified Internet Explorer application.