Some operations in XSI require you to create an ActiveX object. For example, if you want to create an XSICollection, you have to explicitly create it:
set oColl = CreateObject( "XSI.Collection" )
The best way to create an ActiveX object is to use the CreateActiveXObject (XSIFactory) method which is available to any supported scripting language. The principal advantage of this method is that it does not trigger warning messages in Net View, unlike some of the following scripting languages’ native functions:
• Win32::OLE->new (PerlScript)
• win32com.client.Dispatch (Python ActiveX)
![]()
|
The information presented here is a summary of the information available for each language. For more information, please refer to the documentation provided by the scripting language’s vendor or distributor. |
Creates and returns a reference to an Automation object. You can use this function to create hooks into XSI.
Syntax
CreateObject( appname.typename[, pathname] )
Parameters
|
Parameter |
Type |
Description |
|
appname |
The name of the application providing the object (for example, XSI or XSIMath). |
|
|
classname |
The type or class of the object to create (for example, Application, Collection, CreateVector3). |
|
|
pathname |
Optional. Full path and name of the file containing the object to retrieve. |
Example
VBScript Example
' Get an XSICollection and add items to it Set oCollection = CreateObject( "XSI.Collection" ) oCollection.Add "Camera" oCollection.Add "Light"
![]()
|
For more information on this and other VBScript functions, see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vbscripttoc.asp. |
Creates and returns a reference to an Automation object. You can use this function to create hooks into XSI.
Syntax
new ActiveXObject( appname.classname[, pathname] )
Parameters
|
Parameter |
Type |
Description |
|
appname |
The name of the application providing the object (for example, XSI or XSIMath). |
|
|
classname |
The type or class of the object to create (for example, Application, Collection, CreateVector3). |
|
|
pathname |
Optional. Full path and name of the file containing the object to retrieve. |
Example
JScript Example
// Get an XSICollection and add items to it var oCollection = new ActiveXObject( "XSI.Collection" ) oCollection.Add( "Camera" ) oCollection.Add( "Light" )
![]()
|
For more information on this and other JScript functions, see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jslrfjscriptlanguagereference.asp. |
Creates and returns a reference to an Automation object. You can use this function to create hooks into XSI.
Syntax
Win32::OLE->new( appname.typename[, destructor] )
Parameters
|
Parameter |
Type |
Description |
|
appname |
The name of the application providing the object (for example, XSI or XSIMath). |
|
|
classname |
The type or class of the object to create (for example, Application, Collection, CreateVector3). |
|
|
destructor |
Optional. Specifies a method to destroy the ActiveX object. This can be either a code reference or a string containing an OLE method name. |
Example
# Get an XSICollection and add items to it my $coll = Win32::OLE->new( "XSI.Collection" ); $coll->Add( "Camera" ); $coll->Add( "Light" );
![]()
|
For more information on this and other ActivePerl issues, see aspn.activestate.com/ASPN/CodeDoc/Win32-OLE/Win32/OLE.html. |
win32com.client.Dispatch (Python ActiveX)
Creates and returns a reference to an Automation object. You can use this function to create hooks into XSI.
Syntax
win32com.client.Dispatch( appname.typename )
Parameters
|
Parameter |
Type |
Description |
|
appname |
The name of the application providing the object (for example, XSI or XSIMath). |
|
|
classname |
The type or class of the object to create (for example, Application, Collection, CreateVector3). |
Example
Python Example
# You need to explicitly import this extension to use Dispatch import win32com.client # Get an XSICollection and add items to it coll = win32com.client.Dispatch( "XSI.Collection" ) coll.Add( "Camera" ) coll.Add( "Light" )
![]()
|
For more information on this and other Python ActiveX issues, see www.python.org/windows/win32com/QuickStartClientCom.html. |
SOFTIMAGE|XSI v6.01