v4.0
Creates and returns an ActiveX object specified by a scripting ProgID for example "XSI.Collection".
This method can be useful within the context of NetView based html pages as it can be
used to create Automation Object (COM object) such as the
"Scripting.FileSystemObject" object without any NetView warning dialogs.
It is also more convenient method than having to remember the various different
ways of creating activeX objects with other scripting languages such
as JScript, Python and PerlScript.
Each scripting language natively supports the ability to create Automation Objects,
for example "new ActiveXObject" in JScript.
However, when called from Netview, the native methods may result in a
warning message being displayed.
This is because many ActiveX objects, including
objects like "Scripting.FileSystemObject", and "Microsoft.XMLDOM",
are not marked as being safe to be part of a web page. However in the context of
a Netview page running within Softimage these security warnings do not make sense,
so this mechanism makes it possible to bypass them.
All Softimage Automation objects, such as Application, XSIFactory
and XSIMath are marked as safe so this method is not required to
create them.
Object XSIFactory.CreateActiveXObject( String Name ); |
oReturn = XSIFactory.CreateActiveXObject( ProgID ); |
The newly created object
Parameter | Type | Description |
---|---|---|
ProgID | String | Name of the object as a ProgID, in the format "servername.typename". For example "Scripting.FileSystemObject", or "Excel.Sheet". |
' ' This function is a useful tool within Netview Scripts that want to use ' Automation objects like "Scripting.FileSystemObject" ' function SafeCreateObject( in_ProgID ) on error resume next ' First create our ActiveX (which is marked as safe) set oXSIFactory = CreateObject( "XSI.Factory" ) ' Use xsifactory to create the object set oOBj = oXSIFactory.CreateActiveXObject( in_ProgID ) if err.number <> 0 then ' Problem might be that user is running an older version of Softimage, so ' try the old version (this method might pop a ActiveX warning dialog) err.Clear set oObj = CreateObject( in_ProgID ) end if set SafeCreateObject = oObj end function ' Example use set oXML = SafeCreateObject( "Microsoft.XMLDOM" ) oXML.load "c:\info.xml" |
function getFileSystemObject() { // Avoid the warning dialog that will appear NetView // by getting Softimage to create the object for us var oXSIFactory = new ActiveXObject( 'XSI.Factory' ); var fso = oXSIFactory.CreateActiveXObject( 'Scripting.FileSystemObject' ); return fso ; } |
import win32com.client my_xsifactory = win32com.client.Dispatch( "XSI.Factory" ) my_fso = my_xsifactory.CreateActiveXObject( "Scripting.FileSystemObject" ) Application.LogMessage( my_fso.FolderExists( 'C:\\temp' ) ) |