OLE/COM Automation Framework
Description

This library shortens development time of OLE/COM automation controllers in Visual Smalltalk by infering an OLE/COM Automation object's exposed methods and properties and creating an automation controller class with Smalltalk methods to use them.  An automation controller may then be opened with a session on the object simply by creating an instance of the class.  Messages sent to the automation controller instance access properties or invoke methods of the object. The library adds a specialized inspector on an automation controller to display properties of an automation object simply by selecting the property in its list.  It also delivers an option to control Excel 97 by streaming automation commands to an instance of ExcelStream.

The distribution includes workspace examples to control and inspect controller properties of  MS Word, Excel, Internet Explorer, CorelDraw8, CorelPhotoPaint, TextToSpeech, and other Windows applications.

Files

This distribution includes the following files:
 
OLEAuto.st
OLEAuto.sll
OLE/COM automation framework file-in source and library.
ARBase.sll Alejandro Reimondo base components SLL 
FileMe.In Smalltalk source to prepare and open all workspace examples.
OLEAuto Word97.txt
OLEAuto Word95.txt
OLEAuto Speech Examples.txt
OLEAuto PowerPoint.txt
OLEAuto PhotoPaint.txt
OLEAuto Other Examples.txt
OLEAuto Explorer.txt
OLEAuto Excel97.txt
OLEAuto Excel95.txt
OLEAuto CorelDraw.txt
Example workspace files which each demonstrate the OLE automation interface with MS Word, Excel, PowerPoint, and others.
ExcelStream.txt Example workspace file to demonstrate automation streaming protocol with Excel 97.

Additional files are included with the distribution in order to simplify creation of a working directory with VSE 3.1.2 to test the library.

Requirements

VS/VSE 3.1.2 for Win32s.  Requires the following libraries:
 
ARBase.sll Alejandro Reimondo base components SLL 
OLEAuto.sll
OLEAuto.st
OLE/COM automation framework library and file-in source
vreg31w.sll Registration Database Support
voleb31w.sll OLE COM Support
volea31w.sll OLE Automation Support

The automation server applications to be controlled (e.g. MS Word, Excel, etc.) will also need to be installed.

Installation

Install ARBase.sll and OLEAuto.sll in an image using the menu selection File-Install from the Visual Smalltalk Transcript
or copy the libraries to your VSE distribution path and evaluate
#('ARBase' 'OleAuto') do:[:lib|SmalltalkLibraryBinder bindTo: lib].

Examples

Use the menu selection File-Open to open workspaces on the example .txt files. Try evaluating the expressions in the example workspaces with 'Show it' or 'Do it' to test control of the automation servers.   All these example workspaces may be opened by filing in file FileMe.In or evaluating:
(File pathNameReadOnly:'FileMe.In') fileIn; close.
Open a workspace on the file ExcelStream.txt to demonstrate sending commands an Excel automation stream.

As the workspace file OLEAuto Other Examples.txt demonstrates given the version independent ProgID of the automation object from the registry (or obtained from a viewer such as the Microsoft OLE/COM Object Viewer, OleView.exe) one can create an automation controller class by evaluating

    OLEAutomationApplication createApplication: 'VersionIndependentProgID'.

The class is named by the argument provided in the expression above.  For example, if the version independent ProgID of the automation server is Office.Binder the class OfficeBinder is created.  To open an automation controller on the Microsoft Office Binder one would evaluate

    application := OfficeBinder new.

One could then inspect the application by sending the message #inspect to it or obtain a list of the server's methods by sending it the message #selectors.

Additional info

A walkback may occur when selecting a property in an OLE/COM automation component inspector.  This can be expected since requests for properties in the inspector are insensible to whether the OLE component may provide them.  In other words, if you inspect a property that the component is not setup to answer at the moment it will produce an error.  For example, in Excel this may happen by inspecting the currentDocument property when there are no documents open.

When an error occurs in an automation component inspector its list pane is not updated.  This means that each time you select another property in the inspector it will try to send the last offending message to update the text pane and the last walkback will appear again.  If you encounter an error when inspecting an automation property, you can restore the state of the inspector by selecting "self" at the top of the inspector.
 

Contact

Alejandro F. Reimondo
Amenabar 3476 Piso: 2 Dto: B.
Ciudad de Buenos Aires.
Argentina.
Tel: (54)-1-703-5586.
aleReimondo@sugarWeb.com
http://www.sugarweb.com


Links to:
The ObjectShare web site
VisualSmalltalk Product Support
ObjectShare's Online Documentation Site