In
Microsoft Windows applications programming, OLE Automation (later renamed to simply Automation
) is an
inter-process communication mechanism created by
Microsoft
Microsoft Corporation is an American multinational corporation, multinational technology company, technology corporation producing Software, computer software, consumer electronics, personal computers, and related services headquartered at th ...
. It is based on a subset of
Component Object Model (COM) that was intended for use by
scripting languages
A scripting language or script language is a programming language that is used to manipulate, customize, and automate the facilities of an existing system. Scripting languages are usually interpreted at runtime rather than compiled.
A scriptin ...
– originally Visual Basic – but now is used by several languages on Windows. All automation objects are required to implement the
IDispatch
IDispatch is the interface that exposes the OLE Automation protocol. Extending IUnknown, it is one of the standard interfaces that can be exposed by COM objects. COM distinguishes between three interface types: ''custom'' that are VTABLE-based I ...
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
In computing, Dynamic Data Exchange (DDE) is a technology for interprocess communication used in early versions of Microsoft Windows and OS/2. DDE allows programs to manipulate objects provided by other programs, and respond to user actions affec ...
(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.0 built into most desktop Microsoft Office applications. Although based on pre-.NET Visual Basic, which is no longer supporte ...
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 (now simply referred to as "Visual Basic"), the current version of Visual Basic launched in 2002 which runs on .NET
* Visual Basic (c ...
and
Borland Delphi
Delphi is a general-purpose programming language and a software product that uses the Delphi dialect of the Object Pascal programming language and provides an integrated development environment (IDE) for rapid application development of desktop, ...
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 software, legacy dialect of the ECMAScript standard that is used in Microsoft's Internet Explorer 11 and older.
JScript is implemented as an Active Scripting engine. This means that it can be "plugged in" to OLE Aut ...
rather than JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
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 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
Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms such a ...
. Type libraries are used to generate
Proxy pattern In computer programming, the proxy pattern is a software design pattern. A ''proxy'', in its most general form, is a class functioning as an interface to something else. The proxy could interface to anything: a network connection, a large object in ...
/
stub
Stub or Stubb may refer to:
Shortened objects and entities
* Stub (stock), the portion of a corporation left over after most but not all of it has been bought out or spun out
* Stub, a tree cut and allowed to regrow from the trunk; see Pollardi ...
code for interoperating between COM and other platforms, such as
Microsoft .NET
The Microsoft .NET strategy is a marketing plan that Microsoft followed in the early 2000s. Steve Ballmer described it as the company's "most ambitious undertaking since Internet Strategy Day in 1995". In support of this strategy, between 2000 and ...
and
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
. 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 (; ; ar, يَعْقُوب, Yaʿqūb; gr, Ἰακώβ, Iakṓb), later given the name Israel, is regarded as a patriarch of the Israelites and is an important figure in Abrahamic religions, such as Judaism, Christianity, and Islam ...
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
In software design, the Java Native Interface (JNI) is a foreign function interface programming framework that enables Java code running in a Java virtual machine (JVM) to call and be called by
native applications (programs specific to a hardwa ...
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, or simply Office, is the former name of a family of client software, server software, and services developed by Microsoft. It was first announced by Bill Gates on August 1, 1988, at COMDEX in Las Vegas. Initially a ma ...
, 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
ABAP (Advanced Business Application Programming, originally ''Allgemeiner Berichts-Aufbereitungs-Prozessor'', German for "general report preparation processor") is a high-level programming language created by the German software company SAP SE. ...
*
C
*
C++ (with Compiler COM Support, or with libraries like
MFC or
ATL
ATL may refer to:
Places
* Atlanta, a city in the U.S. state of Georgia
** Hartsfield–Jackson Atlanta International Airport (IATA airport code)
** Peachtree station (Amtrak station code)
* Attleborough railway station, located in Norfolk, Engl ...
)
*
C#
*
Visual Basic Visual Basic is a name for a family of programming languages from Microsoft. It may refer to:
* Visual Basic .NET (now simply referred to as "Visual Basic"), the current version of Visual Basic launched in 2002 which runs on .NET
* Visual Basic (c ...
and
Visual Basic for Applications
Visual Basic for Applications (VBA) is an implementation of Microsoft's event-driven programming language Visual Basic 6.0 built into most desktop Microsoft Office applications. Although based on pre-.NET Visual Basic, which is no longer supporte ...
*
Visual FoxPro
Visual FoxPro is a Microsoft data-centric procedural programming language with object-oriented programming (OOP) features.
It was derived from FoxPro (originally known as FoxBASE) which was developed by Fox Software beginning in 1984. Fox Techno ...
*
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 includes the core database engine, a query system, a forms engine, and a programming langua ...
(via OleAutoClient class)
*
Delphi
Delphi (; ), in legend previously called Pytho (Πυθώ), in ancient times was a sacred precinct that served as the seat of Pythia, the major oracle who was consulted about important decisions throughout the ancient classical world. The oracl ...
*
Microsoft .NET
The Microsoft .NET strategy is a marketing plan that Microsoft followed in the early 2000s. Steve Ballmer described it as the company's "most ambitious undertaking since Internet Strategy Day in 1995". In support of this strategy, between 2000 and ...
languages
*
APL (most Windows versions)
*
Java
Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
(only with third-party tools)
*
JScript
JScript is Microsoft's legacy software, legacy dialect of the ECMAScript standard that is used in Microsoft's Internet Explorer 11 and older.
JScript is implemented as an Active Scripting engine. This means that it can be "plugged in" to OLE Aut ...
and
VBScript
VBScript (''"Microsoft Visual Basic Scripting Edition"'') is an Active Scripting language developed by Microsoft that is modeled on Visual Basic. It allows Microsoft Windows system administrators to generate powerful tools for managing computers ...
*
Open Object Rexx
*
Perl
Perl is a family of two High-level programming language, high-level, General-purpose programming language, general-purpose, Interpreter (computing), interpreted, dynamic programming languages. "Perl" refers to Perl 5, but from 2000 to 2019 it ...
*
PHP
PHP is a General-purpose programming language, general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementati ...
*
PowerBuilder
PowerBuilder is an integrated development environment owned by SAP since the acquisition of Sybase in 2010. On July 5, 2016, SAP and Appeon entered into an agreement whereby Appeon, an independent company, would be responsible for developing, sel ...
*
Python
*
Ruby
A 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 sapp ...
(via the 'win32ole' library included in the standard Ruby 1.8.x or later distribution)
*
Tcl
TCL or Tcl or TCLs may refer to:
Business
* TCL Technology, a Chinese consumer electronics and appliance company
** TCL Electronics, a subsidiary of TCL Technology
* Texas Collegiate League, a collegiate baseball league
* Trade Centre Limited ...
*
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 Web. ...
*
Active Scripting
Active Scripting (formerly known as ActiveX Scripting) is the technology used in Windows to implement component-based scripting support. It is based on OLE Automation (part of COM) and allows installation of additional scripting engines in the for ...
*
Object Linking and Embedding
Object Linking & Embedding (OLE) is a proprietary technology developed by Microsoft that allows embedding and linking to documents and other objects. For developers, it brought OLE Control Extension (OCX), a way to develop and use custom user ...
(OLE)
*
Component Object Model (COM)
References
Further reading
*
*
*
* — full printed documentation of the object model of Microsoft Office
External links
OLE AutomationGeneral 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