OLE Automation is a Windows feature that lets scripting languages access system functions and features in other applications. This is also known as "Scripting Objects", but that's a vague term that can mean other things as well. Automation was created originally for the Visual Basic language, and is most often used in VB. Windows Power Users will be familiar with this from working with Visual Basic scripts in programs like Excel, Word, or WScript. If you've done any work creating Visual Pinball tables, you might have used automation objects in VP's Visual Basic scripts.
If you're a Visual Basic user, it might be helpful if we mention that this is the equivalent of VB's CreateObject() function.
One common Windows OLE object that you shouldn't use is MSXML.XMLHTTP (or any of its several versions). You should use PinballY's HttpRequest instead, as it has provisions for asynchronous event handling that can't be easily reproduced with the generic Automation facility.
In such cases, you can solve the mismatch by explicitly creating your own Variant variable, and setting it to the expected type. You can do this as follows:
See Variants for details on the special Variant type.
What's a "property with arguments"? It's a property that doesn't represent just a single value, but represents multiple values, indexed by one or more additional arguments. Conceptually, it's like an array variable. For example, the Scripting.Dictionary object has a property called Item that acts like an array of values that can be indexed by numbers, strings, dates, or anything else. In keeping with the conceptual similarity to arrays, Visual Basic lets you access these properties with syntax exactly like array variables:
To keep the syntax simple for the more common case of ordinary properties, a put_ method is only created when a property takes extra arguments. Ordinary properties with no parameters can be both read and written using the original property name, as in the CompareMode property example at the start of this section.
Some automation object methods take "Out" parameters, which are arguments that the callee uses to return data to the caller.
Specifically, we use Variant objects. If an automation method passes information back through an Out parameter, simply pass a Variant to the method for that parameter. On return, the Variant will be modified to contain the returned information.
Event handling: There's no built-in provision for the COM "event sink" system, which is used in some of the more complex automation objects to send asynchronous events back to the host program. Objects with event callbacks therefore can't easily be used, or at least can't easily be used with their full event systems.