Author Topic: Generating a structure by script  (Read 2188 times)

jk

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Generating a structure by script
« 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!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Generating a structure by script
« Reply #1 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