Chapter 8. OLE Automation

Table of Contents
Overview of OLE Automation
OLE Events
The OLEObject Class
The Windows OLEVariant Class

OLE (Object Linking and Embedding) automation is a subset of COM (Component Object Model). These technologies were first developed on Windows and are deeply embedded in the Windows operating system. Although COM is not tied to the Windows operating system, in practice it is not seen much on other operating systems. Because of this, the ooRexx classes supporting OLE Automation are currently Windows only classes.

Overview of OLE Automation

OLE (Object Linking and Embedding) is an implementation of COM (Component Object Model). OLE automation makes it possible for one application to manipulate objects implemented in another application, or to expose objects so they can be manipulated. ooRexx provides two classes, OLEObject and OLEVariant that allow the programmer to take advantage of this ability to manipulate objects that are exposed as OLE objects.

An automation client is an application that can manipulate exposed objects belonging to another application. An automation server is an application that exposes the objects. The OLEObject class enables Rexx to be an OLE automation client. In addition, some automation servers have an event mechanism that allows them to invoke methods in the OLE automation client. The OLEObject class also supports this mechanism.

Applications can provide OLE objects, and OLE objects that support automation can be used by a Rexx script to remotely control the object through the supplied methods. This lets you write a Rexx script that, for example, starts a Web browser, navigates to a certain page, and changes the display mode of the browser.

Every application that supports OLE places a unique identifier in the registry. This identifier is called the class ID (CLSID) of the OLE object. It consists of several hexadecimal numbers separated by the minus symbol.

Example: CLSID of Microsoft® Internet Explorer (Version 5.00.2014.0216):


The CLSID number can prove inconvenient when you want to create or access a certain object, so a corresponding easy-to-remember entry is provided in the registry, and this entry is mapped to the CLSID. This entry is called the ProgID (the program ID), and is a string containing words separated by periods.

Example: ProgID of Microsoft Internet Explorer: "InternetExplorer.Application"

To find the ProgID of an application, you can use the sample script OLEINFO.REX or the Microsoft OLEViewer, you can consult the documentation of the application, or you can search the registry manually.

Several sample programs are provided in the Open Object Rexx installation directory under samples\ole