Model Parts, Diagrams, Dictionary Items, and Properties > Dictionary items > Script (dictionary item)
  
Script (dictionary item)
For automation interface information about a Script item, click here
A Script item allows you to extend the features and behavior of Modeler. The Script Type property determines the purpose of the Script item:
MenuCommand - Adds new commands to the context menu of valid item types. See Overview of extending context menu commands through stereotypes and scripts.
OnDelete - Specifies behavior when valid item types are deleted. See Overview of extending delete behavior through stereotypes and scripts.
OnDoubleClick - Specifies behavior when valid item types are double-clicked. See Overview of extending double-click behavior through stereotypes and scripts.
OnDrop - For a diagram, specifies behavior when an item is dropped on to or moved on a valid diagram type. For an item, specifies behavior when an item is moved or copied to a valid item type in a Modeler pane. See Overview of extending drop behavior through stereotypes and scripts.
OnModelClose - Specifies a script to run when a model is closed in Modeler. See Overview of extending model open and close behavior through stereotypes and scripts.
OnModelOpen - Specifies a script to run when a model is opened in Modeler. Overview of extending model open and close behavior through stereotypes and scripts
ToolbarCommand- Specifies toolbar buttons for a customized diagram toolbar. See Overview of extending diagram toolbars through stereotypes and scripts.
Utility- Specifies that the Script is a utility that can be run from Modeler. Running Visual Basic scripts from a script item (automation interface) .
VariableElement - specifies validation script for a Variant or Variation Point. See, Overview of variability parameters.
VariantParameter - specifies derivation script for a variability parameter of a Variant or Requires Dependency. See, Overview of variability parameters.
You can create a Script through the context menu of a Model or Package: Right-click the Model or Project, point to New, point to UML, point to Profiles, and then click Script.
You can create a Script through a Stereotype. These Scripts are shown in the Script folder on the Dictionary pane. From a Stereotype's Property Pages:
On the Menu tab, click the New Item button - creates a Script item of type MenuCommand.
On the Toolbar tab, click the New Item button - creates a Script item of type ToolbarCommand.
On the UI Events tab, select the On Drop check box - creates a Script item of type OnDrop.
On the UI Events tab, select the Double Click check box - creates a Script item of type OnDoubleClick.
On the Object Events tab, select the On Delete check box - creates a Script item of type OnDelete.
On the Model Events tab, select the On Open check box - creates a Script item of type OnModelOpen.
On the Model Events tab, select the On Close check box - creates a Script item of type OnModelClose.
You can create a Script through a Tag Definition. These Scripts are shown in the Script folder on the Dictionary pane. From a Tag Definition's Property Pages:
On the Type tab, select the Derived check box - creates a Script item that has no type set.
You can create a Script through a Variant. These Scripts are shown in the Script folder on the Dictionary pane. From a Variant's Property Pages:
On the Parameter tab, select the Derived check box - creates a Script item of type VariantParameter.
On the Validation Script tab, select the Has Script check box - creates a Script item of type VariantParameter.
You can create a Script through a Requires Dependency. These Scripts are shown in the Script folder on the Dictionary pane. From a Requires Dependency's Property Pages:
On the Parameter tab, select the Derived check box - creates a Script item of type VariableElement.
You can create a Script through a Variation Point. These Scripts are shown in the Script folder on the Dictionary pane. From a Variation Point's Property Pages:
On the Validation Script tab, select the Has Script check box - creates a Script item of type VariantParameter.
In the Modeler panes, a short-cut symbol on the Script's icon indicates that the item is a stub.
To write scripts you require a good working knowledge of the VBScript language, the Modeler Meta Model and the Modeler Automation Interface.
WARNING If you run a script that has errors, those errors can corrupt model data and make Modeler crash.
The following sections provide information about how a Script is used in the model. For more information about a property, click it
Properties
In addition to the standard properties, a Script has these properties:
· Constraints
· Hidden
· Script (Script, Script Text or Text through the automation interface)
· Script Type
These properties apply only when the Script Type is Menu Command or Toolbar Command:
· Category
· Command
· Status Bar Text
These properties are available when the Script Type is Menu Command:
· Command Context
· Menu Text
· Separator Before
These properties are available when the Script Type is Toolbar Command:
· Additive (Is Additive Custom Toolbar Command through the automation interface)
· Command Icon (Icon and Icon Available through the automation interface)
· Diagram Toolbar Command (Command Id through the automation interface)
· Group (Command Group through the automation interface)
· Separator Before (Insert Before through the automation interface)
· ToolTip Text
Owned by
Dependency
Model
Package
Stereotype
Tag Definition
Variant
Variation Point
Owns
Comment
Dependency - The Dependency is owned jointly by the Script and the other associated item. The access permissions you have to a Dependency are determined by the access permissions of the dependent item.
Defined in these parts of the model
None.
Shown on these diagrams
Variant Diagram
Can be linked to these dictionary items
A Script is unusual in that it can be linked to Model Item Types, which are not dictionary items or diagrams as such. Linking a Script to a Model Item Type specifies that the Script can be applied to items or diagrams of that type.
Note Like most other items in a Model, a Script can be linked to a Comment.