Creating ActiveX Objects

 
 
 

Some operations in Softimage 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:

Tip

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.

CreateObject (VBScript)

Creates and returns a reference to an Automation object. You can use this function to create hooks into Softimage.

Syntax

	CreateObject( appname.typename[, pathname] )

Parameters

Parameter

Type

Description

appname

String

The name of the application providing the object (for example, XSI or XSIMath).

classname

String

The type or class of the object to create (for example, Application, Collection, CreateVector3).

pathname

String

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"
Tip

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.

new ActiveXObject (JScript)

Creates and returns a reference to an Automation object. You can use this function to create hooks into Softimage.

Syntax

	new ActiveXObject( appname.classname[, pathname] )

Parameters

Parameter

Type

Description

appname

String

The name of the application providing the object (for example, XSI or XSIMath).

classname

String

The type or class of the object to create (for example, Application, Collection, CreateVector3).

pathname

String

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" )
Tip

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.

Win32::OLE->new (PerlScript)

Creates and returns a reference to an Automation object. You can use this function to create hooks into Softimage.

Syntax

	Win32::OLE->new( appname.typename[, destructor] ) 

Parameters

Parameter

Type

Description

appname

String

The name of the application providing the object (for example, XSI or XSIMath).

classname

String

The type or class of the object to create (for example, Application, Collection, CreateVector3).

destructor

String

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

PerlScript Example

	
	# Get an XSICollection and add items to it
	my $coll = Win32::OLE->new( "XSI.Collection" );
	$coll->Add( "Camera" );
	$coll->Add( "Light" );
Tip

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 Softimage.

Syntax

	win32com.client.Dispatch( appname.typename ) 

Parameters

Parameter

Type

Description

appname

String

The name of the application providing the object (for example, XSI or XSIMath).

classname

String

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" )
Tip

For more information on this and other Python ActiveX issues, see www.python.org/windows/win32com/QuickStartClientCom.html.