The GetObject function is similar to the ActiveXObject constructor in that it provides a mechanism for creating and interacting with host objects provided by Microsoft Windows ActiveX automation servers. GetObject is used when a current automation object is already active, or if an automation object is to be retrieved from a file. When the GetObject constructor is called with one or more arguments, the following steps are taken:
Call toPrimitive(nameOrPath, hint Number).
If the type of Result(1) is not String, raise a TypeError exception.
If Result(1) is the empty string, raise a TypeError exception.
If name is not present, go to step 7.
Call the function toPrimitive(name, hint Number).
If the type of Result(5) is not String, raise a TypeError exception.
If only one argument was passed to this function, the string value of Result(1) may be an implementation-dependent file locator or an implementation-dependent automation object name. If two arguments were passed, Result(1) is a file locator, and Result(5) is the automation object name. If only one argument was passed, Step 8 first attempts to interpret Result(1) as a file path; if not successful, Step 8 attempts to interpret Result(1) as an automation object name.
Attempt to create or retrieve a host object that can be used to communicate with the application and application-specific object identified by Result(1) and Result(5).
If any error occurs during Step(8) such that the host object cannot be created or retrieved, raise an Error exception.
The format of the string values passed as arguments to this function are defined by the host operating system.
The length property of the GetObject function has a value of 1.