HOME

TheInfoList



OR:

In
Microsoft Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
applications programming, OLE Automation (later renamed to simply Automation) is an
inter-process communication In computer science, interprocess communication (IPC) is the sharing of data between running Process (computing), processes in a computer system. Mechanisms for IPC may be provided by an operating system. Applications which use IPC are often cat ...
mechanism created by
Microsoft Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
. It is based on a subset of
Component Object Model Component Object Model (COM) is a binary-interface technology for software components from Microsoft that enables using objects in a language-neutral way between different programming languages, programming contexts, processes and machines ...
(COM) that was intended for use by
scripting languages In computing, a script is a relatively short and simple set of instructions that typically automation, automate an otherwise manual process. The act of writing a script is called scripting. A scripting language or script language is a programming ...
– originally Visual Basic – but now is used by several languages on Windows. All automation objects are required to implement the IDispatch interface. It provides an infrastructure whereby applications called ''automation controllers'' can access and manipulate (i.e. set properties of or call methods on) shared ''automation objects'' that are exported by other applications. It supersedes Dynamic Data Exchange (DDE), an older mechanism for applications to control one another. As with DDE, in OLE Automation the automation controller is the "client" and the application exporting the automation objects is the "server". Contrary to its name, automation objects do not necessarily use Microsoft OLE, although some Automation objects can be used in OLE environments. The confusion has its roots in Microsoft's earlier definition of OLE, which was previously more or less a synonym of COM.


Advantages and limitations

To ensure interoperability, automation interfaces are limited to use a subset of all COM types. Specifically, automation interfaces must use SAFEARRAY instead of raw COM arrays. Automation-compatible COM servers can, however, rely on the in-built OLE marshalling implementation. This avoids the need for additional proxy/stub projects for marshalling out-of-process.


Usage

Automation was designed with the ease of scripting in mind, so controllers often provide languages such as
Visual Basic for Applications Visual Basic for Applications (VBA) is an implementation of Microsoft's event-driven programming language Visual Basic 6, Visual Basic 6.0 built into most desktop Microsoft Office applications. Although based on pre-.NET Visual Basic, which is no ...
to end users, allowing them to control automation objects via scripts. Automation objects are often written in conventional languages such as C++, where C++ attributes can be used to simplify development, Languages such as
Visual Basic Visual Basic is a name for a family of programming languages from Microsoft. It may refer to: * Visual Basic (.NET), the current version of Visual Basic launched in 2002 which runs on .NET * Visual Basic (classic), the original Visual Basic suppo ...
and Borland Delphi also provides a convenient syntax for Automation which hides the complexity of the underlying implementation.


Type libraries

In order to automate an application, the developer of an automation controller must know the object model that is employed by the target application exporting activation objects. — despite the title, the article discusses
JScript JScript is Microsoft's legacy dialect of the ECMAScript standard that is used in Microsoft's Internet Explorer web browser and HTML Applications, and as a standalone Windows scripting language. JScript is implemented as an Active Scripting eng ...
rather than
JavaScript JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior. Web browsers have ...
This requires that the developer of the target application publicly document its object model. Development of automation controllers without knowledge of the target application's object model is "difficult to impossible". Due to these complications, Automation components are usually provided with ''type libraries'', which contain
metadata Metadata (or metainformation) is "data that provides information about other data", but not the content of the data itself, such as the text of a message or the image itself. There are many distinct types of metadata, including: * Descriptive ...
about classes, interfaces and other features exposed by an object library. Interfaces are described in Microsoft Interface Definition Language. Type libraries can be viewed using various tools, such as the Microsoft OLE/COM Object Viewer (oleview.exe, part of the Microsoft Platform SDK) or the Object Browser in Visual Basic (up to version 6) and Visual Studio .NET. Type libraries are used to generate Proxy pattern/ stub code for interoperating between COM and other platforms, such as Microsoft .NET and
Java Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
. For instance, the .NET Framework SDK includes tools that can generate a proxy .NET DLL to access Automation objects using both early binding (with information about interfaces extracted from a type library) and late binding (via IDispatch, mapped to the .NET Reflection API), with the built-in .NET-to-COM bridge called COM Interop. While Java lacks built-in COM support, toolsets like
JACOB Jacob, later known as Israel, is a Hebrew patriarch of the Abrahamic religions. He first appears in the Torah, where he is described in the Book of Genesis as a son of Isaac and Rebecca. Accordingly, alongside his older fraternal twin brother E ...
and jSegue can generate proxy source code (consisting of two parts, a set of Java classes and a C++ source for a Java Native Interface DLL) from type libraries. These solutions only work on Windows. Another Java based j-Interop library which enables interoperability with COM components without JNI, using DCOM wire protocol (MSRPC) and works on non-Windows platforms also. Microsoft has publicly documented the object model of all of the applications in
Microsoft Office Microsoft Office, MS Office, or simply Office, is an office suite and family of client software, server software, and services developed by Microsoft. The first version of the Office suite, announced by Bill Gates on August 1, 1988, at CO ...
, and some other software developers have also documented the object models of their applications. Object models are presented to automation controllers as type libraries, with their interfaces described in ODL.


Language support

Automation is available for a variety of languages, including, but not limited to: * ABAP * C * C++ (with Compiler COM Support, or with libraries like MFC or ATL) * C# *
Visual Basic Visual Basic is a name for a family of programming languages from Microsoft. It may refer to: * Visual Basic (.NET), the current version of Visual Basic launched in 2002 which runs on .NET * Visual Basic (classic), the original Visual Basic suppo ...
and
Visual Basic for Applications Visual Basic for Applications (VBA) is an implementation of Microsoft's event-driven programming language Visual Basic 6, Visual Basic 6.0 built into most desktop Microsoft Office applications. Although based on pre-.NET Visual Basic, which is no ...
*
Visual FoxPro Visual FoxPro is a programming language that was developed by Microsoft. It is a data-centric and procedural programming language with object-oriented programming (OOP) features. It was derived from FoxPro (which was itself descended from FoxB ...
*
dBASE dBase (also stylized dBASE) was one of the first database management systems for microcomputers and the most successful in its day. The dBase system included the core database engine, a query system, a Form (programming), forms engine, and a pr ...
(via OleAutoClient class) *
Delphi Delphi (; ), in legend previously called Pytho (Πυθώ), was an ancient sacred precinct and the seat of Pythia, the major oracle who was consulted about important decisions throughout the ancient Classical antiquity, classical world. The A ...
*
MATLAB MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementat ...
* Microsoft .NET languages * APL (most Windows versions) *
Java Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
(only with third-party tools) *
JScript JScript is Microsoft's legacy dialect of the ECMAScript standard that is used in Microsoft's Internet Explorer web browser and HTML Applications, and as a standalone Windows scripting language. JScript is implemented as an Active Scripting eng ...
and VBScript * Open Object Rexx *
Perl Perl is a high-level, general-purpose, interpreted, dynamic programming language. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language". Perl was developed ...
* PHP * PowerBuilder * Python *
Ruby Ruby is a pinkish-red-to-blood-red-colored gemstone, a variety of the mineral corundum ( aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties of gem-quality corundum are called sapph ...
(via the 'win32ole' library included in the standard Ruby 1.8.x or later distribution) * Tcl * Visual DataFlex * WinBatch


See also

*
ActiveX ActiveX is a deprecated software framework created by Microsoft that adapts its earlier Component Object Model (COM) and Object Linking and Embedding (OLE) technologies for content downloaded from a network, particularly from the World Wide W ...
* Active Scripting * Object Linking and Embedding (OLE) *
Component Object Model Component Object Model (COM) is a binary-interface technology for software components from Microsoft that enables using objects in a language-neutral way between different programming languages, programming contexts, processes and machines ...
(COM)


References


Further reading

* * * * — full printed documentation of the object model of Microsoft Office


External links


OLE Automation
General paper on the introduction and problems implementing OLE.
VOLE - A Neat C++ COM/Automation Driver
— an open-source, compiler-independent C++ COM Automation driver library, for use when having to drive IDispatch directly. VOLE is highly robust, fully encapsulates all "low-level" aspects of IDispatch, and is very flexible, taking and returning normal C++ types. {{Microsoft Windows components Object-oriented programming Microsoft application programming interfaces