我在Enterprise Architect中有一个模型,我需要导入Excel中的一些关系(已经存在的元素(。我尝试运行 JScript,但无法运行它(还没有弄清楚原因(。
如何将大量关系导入到模型中?
提前谢谢。
我的脚本是:
!INC Local Scripts.EAConstants-JScript
var connectorArray = new Array(
['{870632BA-154F-4564-AD51-C508C1A7E537}','{4B291196-7B4B-490b-B51D-04B9925CAA2A}','Dependency','','RME1']
);
function main()
{
var source as EA.Element;
var target as EA.Element;
var connector as EA.Connector;
var sourceGUID,targetGUID,type,stereotype,alias;
for(var i = 0; i < connectorArray.length; i++) {
sourceGUID = connectorArray[i][0];
targetGUID = connectorArray[i][1];
type = connectorArray[i][2];
stereotype = connectorArray[i][3];
alias = connectorArray[i][4];
source = Repository.GetElementByGuid(sourceGUID);
target = Repository.GetElementByGuid(targetGUID);
Session.Output("Processing connector: " + alias);
if(source != null && target != null) {
connector = source.Connectors.AddNew("",type);
if(stereotype != "") {
connector.Stereotype = stereotype;
}
connector.SupplierID = target.ElementID;
connector.Alias = alias;
connector.Update();
}
source.Connectors.Refresh();
}
Session.Output("END OF SCRIPT");
}
main();
我的错误是:
[423447640] Hilo de registro de pila establecido para marcos 3
[423447879] Default Directory is C:Program Files (x86)Sparx SystemsEA
[423447879] Agent dll found: C:Program Files (x86)Sparx SystemsEAveax86SSScriptAgent32.DLL
[423447879] Default Directory is C:Program Files (x86)Sparx SystemsEA
[423447879] Agent: Started
[423447967] Microsoft Process Debug Manager creation Failed: 0x80040154
[423447967] This is included as part of various Microsoft products.
[423447967] Download the Microsoft Script Debugger to install it.
[423447967] Failed to initialize JScript engine
[423447967] Sesión de depuración terminada
再次感谢。
好吧,可能是我错了,但你可以看到错误Download the Microsoft Script Debugger to install it
.我猜,您正在尝试运行脚本"调试"按钮而不是"运行脚本"。
如果要调试 scrtipt,则必须安装任何包含 debagger 的Microsoft产品。Microsoft脚本调试器。
仅供参考,您是否在MDG Office集成中尝试了Sparx Systems的Excel导入\导出功能。
您只需单击一下即可在企业架构师中创建\更新\同步模型元素,连接器和其他详细信息。