Script functions, attributes and objects - utility scripts
In addition to the standard Modeler automation interface functions, objects and attributes, there are special functions, objects and attributes you can use in the scripts of Stereotypes and Script items. For general information about extensibility scripts, including information about the Studio, Projects, ActiveProject and Dictionary objects that are available in most script functions, see Script functions, attributes and objects - overview.
To write scripts you require a good working knowledge of the VBScript language, the Modeler Meta Model and the Modeler Automation Interface.
* 
If you run a script that has errors, those errors can cause Modeler to crash and corrupt Modeler model data.
A Utility script can include the following functions. All script must be within one or more of the following functions.
For validating the use of the Utility Script and interacting with the user (for example, opening selection dialogs and displaying messages), use the RunUtilityUI function.
For making updates to the model, use the CommitUtility function.
To open a topic that has a script template for utility scripts, see Script template for utility scripts. The script template includes the preceding functions (empty).
These functions are case sensitive and cannot be used in any other scripts.
RunUtilityUI Script function - This function is called when the associated Utility Script is run.
Use this function to validate the use of the Utility Script and interact with users. This function is run outside of the Utility Script transaction, so its script should not make any changes to the Model.
* 
Do not use the RunUtilityUI function to make changes to the model, because the user will have to perform a refresh to see the changes, and the changes cannot be undone.
If the RunUtilityUI function returns FALSE, the Utility Script operation is abandoned.
CommitUtility Script function - This function is called after the RunUtilityUI function has been called.
Use this function to make updates to the model. This function is run as a transaction, so any changes made by the script are immediately seen in Modeler, and the changes can be undone in Modeler.
* 
Do not use the CommitUtility function to interact with users, because items in the model will be locked and unavailable to other users while that interaction takes place.
If the CommitUtility function returns FALSE, the command operation is abandoned.
Was this helpful?