Defines objects that can be referenced by script.
<object id="objID" [classid="clsid:GUID" | progid="progID"] events="true|false"/>
x = CObj.Prop1
classid="clsid:2154c700-9253-11d1-a3ac-0aa0044eb5f"
The <object> element provides a way to expose objects globally for use in scripting within the script component without having to use a function such as CreateObject(). Using an <object> element makes the object available with global scope, and allows scripting tools to provide statement completion for the object's members.
The following script component fragment includes an <object> element to create an object reference to the ADODB.Connection object.
Note A CDATA section is required to make the script in the <script> element opaque. For details, see Script Component Files and XML Conformance.
<registration progid="ADOScriptlet"/>
<object id="cnn" progid="ADODB.Connection"/>
<public>
<property name="cnnState"/>
<method name="openconnection"/>
</public>
<script language="VBScript">
<![CDATA[
Dim cnnState
Function openconnection()
cnn.ConnectionString =
"driver={SQL Server};server=myserver;uid=sa;database=pubs"
cnn.Open
If cnn.State = 1 Then
cnnState = "open"
cnn.Close
Else
cnnState = "closed"
End If
End Function
]]>
</script>