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

Script Editor

The Script Editor enables you to edit scripts, and to run and stop an open script.

Note:

This facility is available in the Corporate, Business and Software Engineering, Systems Engineering and Ultimate editions.

The editor is based on, and provides the facilities of, the common Code Editor.

To open the Script Editor, double-click on the required script in the Scripts tab of the Scripter window. The editor opens in the main work area.

The VBScript example below is a script that iterates all the packages in the current model and prints their names.

Note:

In the example, note the syntax of declaring variables representing Enterprise Architect's script objects. This syntax enables the editor to present intellisense, but is not necessary for executing the script.

VBSampleScript

The toolbar options enable you to:

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

Enterprise Architect Script 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 intellisense for editing purposes, or Runtime objects, providing access to objects of the types described in the Type Libraries.

The available intellisense scripting objects are:

  • EA
  • MathLib
  • System
  • The runtime scripting objects (below).

The available runtime scripting objects are:

  • Repository [Type: IDualRepository] - this is the Enterprise Architect automation interface
  • Maths [Type: IMath ]
  • Session [Type: ISession ].

Script Editing Intellisense (Required Syntax)

Intellisense is available not only in the Script Editor, but also in the Script Console. Intellisense at its most basic is presented for the inbuilt functionality of the script engine. For intellisense 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 intellisense can be displayed for an item. The syntax can be seen in the above diagram 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.

EditorSyntax

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 )

Keystrokes

In the Script Editor or Console, intellisense 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 intellisense items with a name starting with the string at the point keystroke was pressed.
  • Press [Ctrl]+[Spacebar] when not on a word to display any available top level intellisense items - these are the intellisense objects described above plus any built-in methods and properties of the current scripting language.