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.

Access    View | 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:


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 - see below  )
·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 listed above, 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:


VBTrace( e.


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:


VBTrace( e.Abstract )




In the Script Editor or Console, Intelli-sense is presented on the following 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 described above 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 the following 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 Business and Software Engineering, Systems Engineering and Ultimate editions of Enterprise Architect.



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 (Extensions | MDG Technologies).

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




·The Script Editor is available in the Corporate, Business and Software Engineering, Systems Engineering 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

·Cephes Mathematical Library (3rd-Party, Online Resource)