Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: lubos on October 21, 2009, 10:09:33 pm

Title: JSscript vs JavaScript
Post by: lubos on October 21, 2009, 10:09:33 pm
Hi,
this line is valid in Scripter for JScript

var xmlDOM = new ActiveXObject( "MSXML2.DOMDocument.4.0" );

but it's not valid for JavaScript.
What I have to write to use any COM object using JavaScript?
Thanks for any hint.
Title: Re: JSscript vs JavaScript
Post by: Oliver F. on October 23, 2009, 12:26:54 am
You can't.
JScript uses the Windows scripting engine which enables access to ActiveX and COM.
JAVAScript does not.

Oliver
Title: Re: JSscript vs JavaScript
Post by: mrf on October 23, 2009, 04:59:22 pm
Oliver is correct that it is not supported natively by JavaScript. We do provide a COM wrapper library though that is accessible from JavaScripts within the EA JavaScript engine.

To create a COM object, the syntax for named objects is:

Code: [Select]
var obj = new COMObject("WMPlayer.OCX");
or for ClsIDs

Code: [Select]
var obj = new COMObject("{6BF52A4F-394A-11D3-B153-00C04F79FAA6}");
Please note the curly braces ({}) are required for ClsIDs.