How to use the Enterprise Architect VBScript Library

, ,

The Enterprise Architect VBScript Library is an open source library of VBScripts written to be used in  Enterprise Architect.

This article explains how to download, import and use the library in Enterprise Architect.

Initial Import

Initial scripts

The Enterprise Architect VBScript Library contains some scripts to load and save scripts from/to your file system, but before we can use those we have to import an initial set of scripts to get started.

After downloading the file select menu option Project|Data Management|Import Reference Data and choose the downloaded file. Make sure to select Automation scripts and click Import.

This will import the minimum set of scripts required to load other scripts from the file system



Free Download

Download library from GitHub

From the Enterprise Architect VBScript Library project page on GitHub you can either choose to download the library as a zip file, or download the repository in GitHub desktop.

VBScript library github

Load library into Enterprise Architect

Select scripts folderOne of the scripts in the initial set is the script LoadScripts in the group Script Management. If you execute this script you can choose the library folder from the library downloaded from GitHub.

The script will then scan the entire folder tree and it will load any .vbs file it can find.

For starters it might be interesting to only load the Frameworks scripts as they have the most chance of being useful to anyone.

If the LoadScripts script finds a script that already exists in Enterprise Architect it will ask to overwrite the existing scripts.

In order to know in which group the script belongs it will look for a the group indicator in the script.

'[group=Script Management]

This will tell the script that this script should go in the group Script Management. If the script indicator is absent it will assume the group name is the name of the folder where it was found.

After loading the scripts into EA make sure to press the refresh button to make the scripts appear in the GUI.

Refresh script tree

Saving all your scripts

In the script management group there also a script to save all your scripts to the file system.

In order to control where the script should go you can add the path indicator to the script like this

'[path=\Framework\Tools\Script Management]

The path indicator will control where to place the script relative to the chosen folder.

If the path indicator is absent the name of the script group will be used as name of the folder.

Being able to save and load the scripts from/to the file system now allows us to use version control on these scripts.

The library structure

The library is structured in two main parts.

  • Projects
    Contains an assortment of various scripts written for various projects.
  • Framework
    Contains the framework scripts that are meant to be used by other scripts

    • Utils
      Contains helper scripts and classes such as TextFile, SQL, XML etc..
    • Wrappers
      Contains the wrapper classes for EA elements such as TaggedValue, Script, ScriptGroup

The scripts in the projects folder can be used for inspiration, but it is mainly the scripts int he Framework part that are useful when writing scripts.

Using the library

The first thing you need to do when you want to use any of the framework classes is to include the framework in your script

!INC Wrappers.Include

This will include the “Include” script that takes care of including all the other scripts of the framework, including those of the Utils folder.

Then you can use the classes defined in the library. For example, if you want to have the user select a directory you can use following code

'get the folder from the user
dim folder
set folder = new FileSystemFolder
set folder = folder.getUserSelectedFolder("")

The classes in the library contain both properties as operations. You can use the properties as you would expect from “real” classes.

'show messagebox with the name of each subfolder
dim subfolders, subfolder
for each subfolder in folder.SubFolders
    msgbox "subfolder name: " & subfolder.Name


Have you written any VBScripts for Enterprise Architect you would like to share? If you would like to contribute to the Enterprise Architect VBScript library you can email me at

19 replies
  1. Helmut Ortmann
    Helmut Ortmann says:

    Hi Geert,

    your sripting library is great! It’s a fast way to quickly get results without IDE and..

    In my opinion it’s better to initialize arrays to easy handle empty result sets. See eg XML.vbs: Dim result result = Array() ‘ Initialize to prevent out of range UBOUND (get -1 for empty)

    Personally I prefer ‘CreateObject(“System.Collections.ArrayList”)’ but I don’t know all the pros and cons.

    Find as attachment the two scripts: – Bookmark.vbs (handle bookmarks, eg. Search Window with standard searches) – Clipboard.vbs (handle Clipboard, eg: Search Window with SQL and GUID for elements/packages)

    Both with testcases, not yet complete or fully tested

    Kind regards,


  2. Geert Bellekens
    Geert Bellekens says:

    Hi Helmut,

    Thanks, I whish I discovered sooner that VBScript does classes as well 😉

    You are probably right with regards to the array initialization. I try to avoid those as much as possible (and use ArrayList wherever possible, but a two dimensional array was easier to use in this case then an ArrayList of ArrayLists). I’ll have a look at it one of these days.
    I’m looking forward to your scripts (which you’ll have to email since these wordpress comments don’t do attachments)
    I can add them for you to the library, or if you prefer you can add them yourself on Github. That way you get the credits for your code, whichever you prefer.


  3. Philippe Back (@philippeback)
    Philippe Back (@philippeback) says:

    Hi Geert,

    Awesome library, especially the load/save scripts feature.

    I forked it on GH and added the automation.xml file in the root as it is pretty inconvenient to have to chase for the file, wait for it via email and then reload.

    Maybe would it be good to have a simple one for bootstrapping the whole thing and just having the load scripts in it to prime the system.

    As well as a preference somewhere so that we do not have to respecify the scripts folder every time on save (this itch will be annoying me I guess, so, I may do just something about it).

    There are some extra files in my fork but I do most of my work on a private Bitbucket repo, your being set as upstream.

    On interesting part is that I made classes out of your ExcelImporter v4 VBA code so that this can be run directly from inside EA.

    FWIW, I am working on the other side of the “Project A” (FYI there are remnants of the full A name in the scripts).

    If you are in for a drink or chat, maybe we can find a slot to do so.

    • Geert Bellekens
      Geert Bellekens says:

      Hi Philippe,

      Thanks. I’m not sure I understand what you mean by bootstrapping etc.. but you better explain that to me in person one day.
      I know there are still references to Project A, I just didn’t want it to be too much “in your face”.
      On Mondays, Wednesdays and Friday’s I’m usually at work in Brussels. Maybe we dan do lunch together sometimes? Email me with some available slots.



  4. Libor Novotný
    Libor Novotný says:

    Hi Gert,

    I’m not sure, where to find initial file which can be imported into Enterprise Architect.



    Is it possible to automate creation of Static (Component) diagrams using EA tool?

  6. brothercorvo
    brothercorvo says:

    Hi Geert,
    trying to install the library I get error in the wrappers.script line 91
    when you use CreateObject(“System.Collections.ArrayList”)
    I assume that is the .Net version?
    I have windows 10, .Net 4.7 and EA 14.1

    • Geert Bellekens
      Geert Bellekens says:


      Yes the System.Collection.ArrayList is a .Net Class.
      I’m not sure why it would cause an issue in your case. I’ve never known it to fail.
      Hopefully re-installing the .Net framework helps.


  7. LUCAS
    LUCAS says:

    Trying to parse the EAbrowser through Repository.GetTreeSelectedItemType() : I then have discovered myPackage.Packages, myPackage.Elements, and myElement.EmbeddedElements (such as ports or providedInterfaces). But I dont succeed in parsing a Component which contains itself components : they appear neither in myComponent..Elements nor in myComponent.EmbeddedElements : does someone know how to discover them ?
    Thanks !

      • Sergio
        Sergio says:

        Ran IntegrityCheck in EA 13 and subcomponent is definitively not found among myComponent.Elements
        For Each subComponent in currentComponent.Elements
        MsgBox “sub elt ‘” & subComponent.Type & “‘ of ” & currentComponent.Name & “:” & subComponent.Name & ” found!” displays nothing although a component (not an instance) appears in the browser 🙁
        Any other idea ?

        • Geert Bellekens
          Geert Bellekens says:

          Are you sure you are using a regular component and not a packaging component?
          Because a packaging component is in fact a package in terms of API.

          Each package as also has an EA.Element (see EA.Package.Element) but the owned elements of a package are listed in Package.Elements, not in Element.Element.
          The package and element always have the same GUID, so you can easily check if there is a corresponding Package for your Component by doing “set myPackage = Repository.GetPackageByGUID(currentComponent.ElementGUID)”

          • Sergio
            Sergio says:

            Sure it is a regular component. currentComponent.Elements.Count returns 0 instead of 1.

          • Sergio
            Sergio says:

            However, once I parsed embededElements of currentComponent, currentComponent is strangely set to the last InterfaceElement found (seen by displaying currentComponent.Name after the ForEach) ! The reason is here, I have now to search why…
            Thanks for your reactivity !

  8. Sergio
    Sergio says:

    Hi Geert, Could you indicate how is it possible in automation to get a link L2, on a diagram, that links an Element E to a link L1 ? Because myDiagram.diagramLinks actually contains L1, but not L2… In addition, how could we distinguish an Element2Element_link like L1 from an Element2Connector_link like L1 ? (we can obtain L1.SupplierId, but without knowing weither SupplierId is an Element or a Connector…) Thanks !


Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.