How Active Scripting Works
This section discusses some internals of the Active Scripting mechanism. Although this information isn’t necessary for you to use Python in an Active Scripting environment, it may help you understand some of the intricacies of the Active Scripting implementations. Understanding this section is required for the next section.
As mentioned previously, Active Scripting is a COM-based technology and works by providing an object model for the end user. It should come as no surprise that this object model is provided by COM.
To summarize a complicated specification in a few paragraphs, here’s the general process an application uses when using Active Scripting:
Determines the language to be used for a particular script block and creates the language engine as a normal COM object. Thus,
VBScript,JScript, andPythonare the COM ProgIDs used for the languages described here.Passes the language engine a series of named items. Each named item is a COM object (that is, an
IDispatchpointer) with a name and attributes. The attributes include whether the item is considered global and whether the item fires events.Each named item is placed in the namespace by the language engine. Any named items that fire events have the event-handling mechanism put in place. In addition, any object considered global should have all its methods and properties made available as global methods and properties.
The application then gives the language engine the script code to execute. When the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access