OLE_CreateObject() Function
- Last UpdatedFeb 20, 2017
- 1 minute read
Before you can reference an OLE object in a script, you must create it. When you do this you receive a pointer that references the OLE object.
In a script, you can create an OLE object and assign a pointer by using the OLE_CreateObject() function.
Syntax
OLE_CreateObject(%pointer, classname);
Parameters
%pointer
The name of your choice for the pointer to the OLE object. It can contain alphanumeric characters (A-Z, 0-9) and underscore. It is case-insensitive.
classname
The name of the OLE class. The class name is case-sensitive. A literal string value, message tagname, or string expression.
Remarks
If you use the same object name to create another object, the object is updated to reference the new OLE class. It is released from the old OLE class.
Example(s)
This script creates an OLE object called %WShell that references the class Wscript.Shell.
OLE_CreateObject(%WShell, "Wscript.Shell");