| |
Windows Script Components
With Windows Script Components (WSC) you can package scripts written in any language
with a supporting ActiveX Scripting Interface-such as VBScript, JScript PerlScript, and
Python-as COM components. These components can be used as automation objects in
applications developed with tools like Visual Basic, and Dynamic HTML (DHTML) behaviours.
Advantages
 |
Efficiency |
 |
They are easily created, maintained, and deployed. |
 |
A type library can be created to be taken advantage of by object browsers. |
 |
DHTML behaviours add interactive effects to Web pages, that are easily reused. |
Creating
Creating a scripting component is easy. A WSC file is an XML document with elements
that define the component and its behaviour.
Elements
 |
<package> |
Contains multiple component definnitions. |
 |
<component> |
Contains the script component definition. |
 |
<reference> |
Contains type library references. |
 |
<public> |
Encloses definitions for properties, methods, and events that your
script component exposes. The definitions point to variables or functions defined in a
separate <script> block. |
 |
<registration> |
Information used to register the component as a COM component. |
 |
<script> |
Contains the script used to implement the logic of your script
component, depending on what type of COM component you are creating. For example, if you
are creating a COM Automation component, you declare properties, methods, and events in a
<public> element, and then write the script to define them in one or more
<script> elements. |
 |
<implements> |
Specifies the COM interface handler for the script component, which
determines what type of COM component the script component will be. For example, by
specifying <implements type=ASP>, you implement the ASP interface handler and
therefore get access to the ASP object model in your script component. The
<public> element is used to specify that a script component implements the COM
Automation interface handler. Therefore, you don't need to create an <implements>
element for the Automation handler.
Note The script component
run-time includes interface handlers for Automation (exposed using the <public>
element), for ASP, and for Internet Explorer 5.0 DHTML Behaviors. Other interface handlers
are available as external DLLs. For more information about additional interface handlers
and script components, see the Microsoft Scripting Technologies Web site. |
 |
<object> |
Contains information about an object that you use in your script, such
as another COM component. |
 |
<resource> |
Contain values that should not be hard-coded into script component
code. Resource elements can include information that might change between versions,
strings that might be translated, and other values |
 |
<comment> |
Contain text that is ignored when the script component is parsed and
executed. |
|