Prev | Next |
JavaScript Console
The JavaScript console is a command line interpreter that accepts single line JavaScript commands that will be executed one at a time. You type the commands into the text entry panel at the bottom of the screen and, when you press the
to execute the command, it is added to the upper, output window with any output from the command. Consider this example.In the bottom panel, the user has typed:
currentElement = Repository.GetTreeSelectedObject()
They have pressed the Enter key, and the command has been displayed in the top panel. The user has then typed, in the lower panel:
Session.Output("Selected ElementID:"+currentElement.ElementID)
When they press the Enter key, the Console displays this command and the output from the command.
The user then enters a third command:
Session.Output("SelectedElementGUID:" + currentElement.ElementGUID)
This results in the output shown here, in the upper panel:
This feature is available in the Corporate, Unified and Ultimate editions of Enterprise Architect.
Access
Ribbon |
Specialize > Tools > JavaScript Simulate > Console > JavaScript |
Console Commands
Console commands are preceded by the ! character and instruct the console to perform an action.
The available console commands include:
- !clear - clears the console display
- !save - saves the console display to a file
- !help - prints a list of commands
- !close - closes the console
- !include <scriptname> - executes the named script item; scriptname is of the format GroupName.ScriptName (spaces are allowed in names)
- ? - lists commands (same as !help)
- ? <variable or function name> - outputs the value.
To list these commands on the 'Console' tab itself, type ? in the lower panel (without the preceding ! character) and press the
.If you intend to execute scripts, you might want to have the Script Library (Scripting window) open as well, so that you can see the scripts available to call. Select the 'Specialize > Tools > Script Library' ribbon option.