Scripting Object

The Scripting object provides a means of attaching events to dynamically created COM objects. It also provides other useful properties and methods when running script with mgcscript command. The Scripting object is automatically created and added to the currently running script as a variable named Scripting.
Table 1. Scripting Object Methods and Properties

Method or Property

Description

AddTypeLibrary Method (Scripting Object)Binds constants (enums) that the specified Type Library defines, into the currently running script.
AttachEvents Method (Scripting Object)Attaches an object's event sources to script functions with a given prefix.
CreateObject Method (Scripting Object)Create and return a reference to an Automation Object. If the new object has an associated type library, the method automatically adds the type library to the script.
DetachEvents Method (Scripting Object)Detaches an object's event sources from script functions with a given prefix.
ExpandEnvironmentStrings Method (Scripting Object)Translates an environment variable string.
GetEnvVariable Method (Scripting Object)Translate Environment variable.
SetEnvVariable Method (Scripting Object)Set Environment variable. This will only set the value for the current process.
Sleep Method (Scripting Object)Suspend script execution.
DontExit Property (Scripting Object)Set to true to keep the script from exiting after the last statement executes.
Globals Property (Scripting Object)Returns global name/key - value pairs. Use this property for script-to-script communications.
IsUnix Property (Scripting Object)Indicates whether or not the script is running on a Unix based system.
OSName Property (Scripting Object)Sets or returns the Operating System name string.
OSVersion Property (Scripting Object)Sets or returns the Operating System version string.