Script (automation interface)
A Script allows you to extend the features and behavior of Modeler.
When a script is owned by a stereotype or tag definition, the script item is not shown in Modeler, but you can see selected properties of the script through the Property Pages of Stereotypes and Tag Definitions.
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 corrupt Modeler model data and make Modeler crash.
ATTRIBUTES
In addition to the
common attributes.
Command Context
A string that specifies the context of the Script. Possible values are as follows:
0 = Universal
1 = DictItemOnly
2 = SymbolOnly
Access is read/write.
Command Group
A string that specifies whether a customized diagram button appears as a standalone button or as part of a group of buttons:
• A value of 0 specifies that the button is a standalone button.
• A value other than 0 specifies that the button is grouped with other buttons that appear on the same tab and have the same Group value.
Access is read/write.
Command Id
A string that specifies the Id of a toolbar button that is added to a customized diagram menu through the script. Each Control Id relates to a command that is listed in the Diagram Toolbar Command list in Modeler.
Access is read/write.
Hidden
A string indicating that a Script is hidden from the Modeler user interface and is not used: For MenuCommand scripts, no context menus are created for the Script; for ToolbarCommand scripts, no tab buttons are created for the Script; for OnDelete, OnDoubleClick, OnDrop, OnModelClose and OnModelOpen scripts, the Script is not run when the associated action occurs. Possible values are TRUE or FALSE.
Access is read/write.
Icon
Stores a selected icon file. When an icon has been selected, the Icon Available attribute is set to TRUE.
Access is read/write.
Icon Available
A string indicating that an icon has been selected for a Script whose script type is ToolbarCommand. Possible values are TRUE or FALSE. The image is stored using the Icon attribute.
Access is read/write.
Insert Separator
A string that specifies that a separator should be inserted to the left of a diagram tab command, or a separator should be inserted above a menu command.
Access is read/write.
Is Additive Custom Toolbar Command
A string that specifies that the diagram command button is added to the default buttons of the diagram ribbon tab, rather than replacing the default buttons of the diagram ribbon tab.
Access is read/write.
Menu Text
A string that specifies the text of a command that is added to a context menu through the Script:
• To create a submenu, include a backslash. For example, My Submenu\My Command.
• To create a shortcut letter for the command, prefix the letter with an ampersand. For example, &My Command
• To use an ampersand in the command name, prefix the ampersand with an ampersand. For example, Delete && Propagate
Access is read/write.
Script
A string that specifies the script of a script object. The text includes rich text tags.
If you require the text of the script as plain text, use the Text attribute.
If you require the text of the script with Model Object References replaced with their Modeler IDs, use the Script Text attribute.
Access is read/write.
Script Category
A string that specifies a category value for a script.
For each diagram button and menu command created through a Script item that you want to group together, set the Category property to the same value in each case.
Access is read/write.
Script Index
A string that specifies a command value for a script.
For each diagram button and menu command created through a Script item that you want to group together, set the Category property to the same value in each case. Within that grouping, determine the order of the buttons or commands through the Command values – lowest value first, highest value last.
Access is read/write.
Script Text
A string that returns the script of a script object. Script Text replaces Model Object References with their Modeler IDs prefixed with 'v_'.
If you require the text of the script including rich text tags, use the Script attribute.
If you require the text of the script as plain text, use the Text attribute.
Access is read-only.
Script Type
A string that specifies the purpose of the script object. You can set Script Type to the following values:
• MenuCommand - Script adds new command to the context menu of valid item types.
• OnDoubleClick - Script specifies behavior when valid item types are double-clicked.
• OnDelete - Script specifies behavior when an item or diagram is going to be deleted.
• OnDrop - Script specifies behavior when an item is dropped on to a valid item or diagram type.
• OnGet -Script specifies derivation script for a derived Tag Definition.
• OnModelClose - Script is run when the model is closed in Modeler.
• OnModelOpen - Script is run when the model is opened in Modeler.
• ToolbarCommand - Script specifies toolbar buttons for a customized diagram toolbar.
• Utility - Script specifies a utility that can be run from Modeler.
• VariableElement - specifies validation script for a variability parameter of a Variant.
• VariantParameter - specifies derivation script for a variability parameter of a Variant or Requires Dependency.
Status Bar Text
A string that specifies the text that is displayed in the Modeler status bar when the mouse pointer is paused over a customized context menu command or customized diagram tab button.
Access is read/write.
Text
A textual property that is derived from the Script property as plain text.
If you require the text of the script including rich text tags, use the Script attribute.
If you require the text of the script with Model Object References replaced with their Modeler IDs, use the Script Text attribute.
Access is read/write.
Token RTF
A textual property that is derived from the Script property as rich text.
Token RTF replaces Model Object References with their Modeler IDs delimited by the Token Delimiter.
Access is read/write.
Token Text
A textual property that is derived from the Script property as plain text.
Token Text replaces Model Object References with their Modeler IDs delimited by \£.
Access is read-only.
ToolTip Text
A string that specifies the ToolTip text for a button that is added to a customized diagram ribbon tab through the script.
Access is read/write.
ASSOCIATIONS:
In addition to the
common associations
Applicable Type
Relationship to the diagram types that are valid for a context menu command:
• If no diagram types are specified, the context menu command can appear on all diagram types.
• If one or more diagram types is specified, the context men command can appear only on those diagram types.
You can specify standard diagram types and diagram types created through Stereotypes, such as SysML and UPDM diagram types.
Multiplicity is 0+, access is read/write.
See also, Applicable Type Candidate.
Applicable Type Candidate
Relationship to diagram types that are valid for use with the Applicable Type association.
Multiplicity is 0+, access is read-only.
See also, Applicable Type.
Category or Package
Relationship to scoping package.
Multiplicity is 0-1, access is read/write.
Meta Model Type
Relationship to valid item types. The Script applies to items that are valid.
Multiplicity is 0+, access is read/write.
Script Owner
Relationship to a Stereotype or Tag Definition that owns the script.
Multiplicity is 0-1, access is read/write.