Book a Demo

Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Prev Next

Script Editor

Using the Script Editor you can perform a number of operations on an open script file, such as:

  • Save changes to the current script
  • Save the current script under a different name
  • Run the script
  • Debug the script
  • Stop the executing script
  • View the script output in the 'Scripts' tab of the System Output window

The editor is based on, and provides the facilities of, the common Code Editor in the application work area.



Specialize > Tools > Scripting > Scripts > right-click on [script name] > Edit Script   or

Specialize > Tools > Scripting > Scripts > double-click on [script name]




See also

Scripting Objects

Enterprise Architect adds to the available functionality and features of the editor script language by providing inbuilt objects; these are either Type Libraries providing Intelli-sense for editing purposes, or Runtime objects providing access to objects of the types described in the Type Libraries.

The available Intelli-sense scripting objects are:

  • EA
  • MathLib
  • System

The runtime scripting objects are:

  • Repository (Type: IDualRepository, an instance of EA.Repository, the Enterprise Architect Automation Interface)
  • Maths (Type: IMath, an instance of MathLib; this exposes functions from the Cephes mathematical library for use in scripts)
  • Session (Type: ISession, an instance of System)
Automation Interface Session Object

Script Editing Intelli-sense (Required Syntax)

Intelli-sense is available not only in the 'Script Editor', but also in the 'Script Console'; Intelli-sense at its most basic is presented for the inbuilt functionality of the script engine.

For Intelli-sense on the additional Enterprise Architect scripting objects (as listed) you must declare variables according to syntax that specifies a type; it is not necessary to use this syntax to execute a script properly, it is only present so that the correct Intelli-sense can be displayed for an item.

The syntax can be seen in, for example:

     Dim e as EA.Element

Then when you type, in this case, e., the editor displays a list of member functions and properties of e's type.

You select one of these to complete the line of script; you might, therefore, type:


As you type the period, the editor presents the appropriate list and you might double-click on, for example, Abstract; this is inserted in the line, and you continue to type or select the rest of the statement, in this case adding the end space and parenthesis:



In the Script Editor or Console, Intelli-sense is presented on these keystrokes.

  • Press . (period) after an item to list any members for that item's type
  • Press Ctrl+Spacebar on a word to list any Intelli-sense items with a name starting with the string at the point the keys were pressed
  • Press Ctrl+Spacebar when not on a word to display any available top level Intelli-sense items - these are the Intelli-sense objects already described plus any built-in methods and properties of the current scripting language

Include script libraries

An Include statement (!INC) allows a script to reference constants, functions and variables defined by another script accessible within the Scripting Window. Include statements are typically used at the beginning of a script.

To include a script library, use this syntax:

     !INC [Script Group Name].[Script Name]

For example:

     !INC Local Scripts.EAConstants-VBScript

Using Inbuilt Math Functions

Various mathematical functions are available within the Script Editor, through the use of the inbuilt Maths object.

You can access the Maths object within the Script Editor by typing 'Maths' followed by a period. The Intelli-sense feature displays a list of the available mathematical functions provided by the Cephes Mathematical Library. For example:

     Session.Output "The square root of 9 is " & Maths.sqrt(9)

     Session.Output "2^10 = " & Maths.pow(2,10)

The Maths object is available in the Unified and Ultimate editions of Enterprise Architect.

Using COM / ActiveX Objects

VBScript, JScript and JavaScript can each create and work with ActiveX / COM objects. This can help you to work with external libraries, or to interact with other applications external to Enterprise Architect. For example, the Scripting.FileSystemObject Class can be used to read and write files on the local machine. The syntax for creating a new object varies slightly for each language, as illustrated by these examples:


set fsObject = CreateObject("Scripting.FileSystemObject")


fsObject = new ActiveXObject("Scripting.FileSystemObject");


fsObject = new COMObject("Scripting.FileSystemObject");

Using JavaScript with out-of-process COM servers

Users of JavaScript in Enterprise Architect can access out-of-process COM servers. The application must be registered on the machine as providing local server support. The syntax for creating or obtaining a reference to an out-of-process server is:

     var server = new COMObject(progID, true);

where progID is the registered program ID for the COM component ('Excel.Application', for example).

System Script Library

When Enterprise Architect is installed on your system, it includes a default script library that provides a number of helpful scripting functions, varying from simple string functions to functions for defining your own CSV or XMI import and export.

To use the script library you must enable it in the 'MDG Technologies' dialog ('Specialize > Technologies > Manage' ribbon option).

Scroll through the list of technologies, and select the 'Enabled' checkbox against 'EAScriptLib'.


  • The Script Editor is available in the Corporate, Unified and Ultimate editions
  • Enterprise Architect scripting supports declaring variables to match the Enterprise Architect types; this enables the editor to present Intelli-sense, but is not necessary for executing the script

Learn more