Your Windows® Script Component can include references to external components that you need to create the script component, such as:
In your script component, it might be necessary to create instances of other COM components as needed. You can do so in two ways:
Note Although <object> elements in script components are similar to <OBJECT> tags in HTML pages, the list of attributes for an <object> element in a script component is shorter, because script components do not present a user interface.
To create an OBJECT element
The following example shows an object definition in a script component.
<object id="cnn" progid="ADODB.Connection"/>
Many components that you might work with support type libraries, which provide a complete listing of the component's classes and their members. By referencing the component's type libraries, you can use constants defined in the type library.
To include a reference to a type library
Resource elements can include information that might change between versions, strings that might be translated, and other values.
To reference resources
Note A CDATA section is required to make the contents of the <resource> element opaque to the parser. For details, see Script Component Files and XML Conformance.
<component id="MyScriptlet"> <public> <method name="random" internalName="getRandomNumber"/> </public> <resource id="errNonNumeric"><![CDATA[Non-numeric value passed]]> </resource> <resource id="errOutOfRange"><![CDATA[Passed value is out of range ]]> </resource>
Note A CDATA section is required to make the script in the <script> element opaque to the parser. For details, see Script Component Files and XML Conformance.
<script language="VBScript"> <![CDATA[ Function getRandomNumber(upperBound) If IsNumeric(upperBound) Then getRandomNumber = Cint(upperBound * Rnd + 1) Else getRandomNumber=getResource("errNonNumeric") End If End Function ]]> </script>