Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: jk on August 06, 2018, 05:28:49 pm

Title: Generating a structure by script
Post by: jk on August 06, 2018, 05:28:49 pm
Hello all,

I would like to write a javascript to generate automatically (after right-clicking in the project browser > "scripts" > "the script.js") a certain structure within a package.

Have you any ideas how to do this? I have no idea yet.


Thanks in advance!
Title: Re: Generating a structure by script
Post by: Geert Bellekens on August 06, 2018, 06:22:25 pm
There are a few examples in the local scripts and the scripting MDG that should help you going.

Basically you'll need to

- get the selected package
- do an AddNew() on the selectedPackage.Packages collection
- Update the new package
- do AddNew() on the new packages Elements and/or Packages collection
- Update() on each new element/package

Geert

PS. VBscript example can also be found here: https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library