|
Script Object |
|
See Also: |
The Script.CreateObject() method creates a COM object, and optionally activates script handling of its events.
VBScript:
JScript:
| Script | The Script object. |
| strProgID | The PROGID of the component being created. |
| strHandlerPrefix | Optional. If supplied, script functions named strHandlerPrefix + EventName are called when this object fires events. |
| objObject | The created COM object. |
The CreateObject() method creates a COM object specified by the strProgID parameter. If the parameter strHandlerPrefix is specified, APGen connects to the object's default event interface after creating the object. When the object fires an event, APGen calls a script subroutine named strHandlerPrefix plus the event name.
For example, if strHandlerPrefix is "Conn1_" and the object fires an event named "OnConnect", APGen calls the "Conn1_OnConnect" subroutine if one can be found in the script.
Script event handling for an object can be disabled by calling Script.DisconnectEvents() and passing in the object.
For more information on handling COM events, see the Sinking COM Events topic.
This example uses Script.CreateObject() to create an APGen object and run another APG script.
...
Dim oAPGen, oScript
Set oAPGen = Script.CreateObject("APGen")
oAPGen.Run("Script.apg")
...