Prev | Next |
Scripting
Enterprise Architect's scripting environment is a flexible and easy to use facility that supports both JavaScript and the Microsoft scripting languages JScript and VBScript. When any script runs, it has access to a built-in 'Repository' object. Using this script object you can programmatically inspect and/or modify elements within your currently open model. Enterprise Architect also provides feature rich editors, and tools to run, debug and manage your scripts. Scripts are modular and can include other scripts by name using the !include directive. They can be used for a broad range of purposes, from documentation to validation and refactoring, and they can be of enormous help with automating time consuming tasks.
Script Engine Support
- Mozilla SpiderMonkey [ version 1.8 ]
- Microsoft Scripting Engine
Script Languages
- JavaScript
- JScript
- VBScript
Benefits
- Inspecting and reporting on model and element composition
- Modifying and updating element properties
- Running queries to obtain extended model information
- Modifying diagram layouts
- Being called from report document templates to populate reports
- Creating and implementing process workflows
- Being included in MDG Technologies to augment domain specific languages
- Extensive UI access to scripts through context menus
- Automation Server role for in-process and out-of-process COM clients (Scripting is itself an example of an in-process client; Add-Ins are another)
- Element access governance through Workflow security
- Model Search integration
Script Groups
Scripts are managed and contained in groups. Each group has an attribute called 'Type'. This attribute is used to help Enterprise Architect decide how and where the script can be used and from which features it should be made available. The properties of a script group can be viewed from its shortcut menu.
Script Storage
Built in scripts are file based and are installed with Enterprise Architect. They appear under the Local Scripts group.
You cannot edit or delete Local scripts, but you can copy the contents easily enough.
User defined scripts are model based and as such, can be shared by a community. They are listed in the group to which they belong..
Using Scripts
The management interface for Scripting is the Scripting window, which contains the:
- Script Tree View ('Scripts' tab), which you use to review, create and edit scripts
- Script Console ('Console' tab), which you use to operate on an executing script
Other than the Local Scripts, which are file based and installed with Enterprise Architect, all other scripts are stored as model assets and can be shared with its users. Script debuggers can help you with script development and script editors can provide you with information on the automation interfaces available to you. Analyze the execution; for example, by recording a Sequence diagram of the script execution, and halting execution to view local variables.
Notes
- This facility is available in the Corporate, Unified and Ultimate editions
- If you intend to use the Scripting facility under Crossover/WINE, you must also install Internet Explorer version 6.0 or above