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
Using Scripts
The management interface for Scripting is the Scripting window, showing the Script Tree View, which you use to review, create and edit scripts.
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 all users of the model. Script debuggers can help you with script development and script editors can provide you with information on the automation interfaces available to you. You can analyze the execution, for example by recording a Sequence diagram of the script execution and halting execution to view local variables.
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 Solvers
Anywhere in Enterprise Architect that has JavaScript code, such as in Simulation, you can now use a JavaScript construct called 'Solver' (the Solver Class) to integrate with external tools and have direct use of the functionality within each tool to simply and intuitively perform complex maths and charting functions. The calls help you to easily interchange variables between the built in JavaScript engine and each environment. Two Math Libraries that are supported are MATLAB and Octave.
To use the Solver Class, you need to have a knowledge of the functions available in your preferred Math Library and the parameters they use, as described in the product documentation.
Being part of the JavaScript engine, Solver Classes are also immediately accessible to Add-In writers creating model based JavaScript Add-Ins.
Also see the Octave Solver, MATLAB Solver and Solvers Help topics.
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