Creating XSI objects in Netview


If you want to use objects like XSIApplication, XSIMath, XSIUtils, and XSIFactory in NetView scripts, you need to know the [mostly undocumented] progIDs of those objects.

window.onload = onLoadHandler;

//-------------------------------------------
// OnLoadHandler for any HTML page 
// that includes this .js file
//-------------------------------------------
function onLoadHandler() {

	//-------------------------------------------
	// Create instances of Softimage objects.
	//-------------------------------------------

	try {
		var Application = new ActiveXObject('XSI.Application');
		var XSIUtils = new ActiveXObject('XSI.Utils');
		var XSIMath = new ActiveXObject('XSI.Math');
		var XSIFactory = new ActiveXObject('XSI.Factory');
	} catch ( e ) {
		alert( e );
	}
}

Here’s a script that uses WMI to find the progIDs of XSI COM automation objects:

var sComputer = XSIUtils.Environment("COMPUTERNAME");

ListCOM( sComputer );

function ListCOM( computer )
{ 
	var wmistr = "winmgmts:{impersonationLevel=impersonate}!\\\\"; 
	wmistr += computer + "\\root\\cimv2";
	var wmi = GetObject( wmistr );
	var query = "SELECT * FROM Win32_ClassicCOMClassSetting";
	var com = wmi.ExecQuery( query );
	var ecom = new Enumerator( com );
	for( ; !ecom.atEnd(); ecom.moveNext() )
	{
		var icom = ecom.item();  
		if ( icom.Caption != null && icom.Caption.indexOf( "XSI" ) > -1 && icom.VersionIndependentProgId != null)
		{
			LogMessage( "name   : " + icom.Caption );
			LogMessage( "progid : " + icom.VersionIndependentProgId );
			LogMessage( "" );   
		}
	} 
}

And here’s the script output on my machine:

// INFO : name   : XSIDialog Class
// INFO : progid : XSIDial.XSIDialog
// INFO : 
// INFO : name   : XSI Framebuffer List Widget Class
// INFO : progid : FramebufferListWidget.FramebufferListWidget
// INFO : 
// INFO : name   : XSI Factory Object
// INFO : progid : XSI.Factory
// INFO : 
// INFO : name   : XSI Scripting Environment Object
// INFO : progid : Scripting.Environment
// INFO : 
// INFO : name   : XSI Utility Object
// INFO : progid : XSI.Utils
// INFO : 
// INFO : name   : XSI Plugin Helper Object
// INFO : progid : XSI.PluginHelper
// INFO : 
// INFO : name   : XSIFileConverter Object
// INFO : progid : XSI.XSIFileConverter
// INFO : 
// INFO : name   : XSIFileService Object
// INFO : progid : XSI.XSIFileService
// INFO : 
// INFO : name   : XSI UIToolkit Object
// INFO : progid : XSI.UIToolkit
// INFO : 
// INFO : name   : XSI Application Object
// INFO : progid : XSI.Application
// INFO : 
// INFO : name   : XSI Math Module
// INFO : progid : XSI.Math
// INFO : 
// INFO : name   : XSI Render Channel List Widget Class
// INFO : progid : RenderChannelListWidget.RenderChannelListWidget
// INFO : 
// INFO : name   : XSIFileFormat Object
// INFO : progid : XSI.XSIFileFormat
// INFO : 
// INFO : name   : XSI Image Format Chooser Class
// INFO : progid : ImageFormatChooser.ImageFormatChooser
// INFO : 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s