Customization > Extensibility Through Profiles, Stereotypes, Tag Definitions and Scripts > Advanced extensibility through stereotype scripts and script items > Extending model open and close behavior > Setting up model close behavior through a script
  
Setting up model close behavior through a script
1. Right-click the profile Package, point to New, point to UML, point to Profiles, and then click Script.
2. Type a name for the Script, and then press the Enter key.
3. Open the Script's Property Pages, and then click the Items tab.
4. Click the Link button, select the check box associated with the Model entry, and then click OK.
5. Click the Settings tab.
6. In the Script Type list, select OnModelClose.
7. Click the Script tab.
8. In the box, type the script to run when the model is closed in Modeler.
If you want to change the text in a larger window with the Text Format Toolbar available, click the Editor button.
For more information about working with scripts, see the following topics:
Script functions, attributes and objects - model close and open scripts
Script functions, attributes and objects - overview
Script template for model close scripts
The script is run whenever the model is closed in Modeler.