Customization > Extensibility Through Profiles, Stereotypes, Tag Definitions and Scripts > Advanced extensibility through stereotype scripts and script items > Extending drop behavior through stereotypes and scripts > Changing drop behavior through a script
  
Changing drop behavior through a script
Typically, you will want to create Scripts within a profile Package.
To change drop 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 item or diagram types for which you want to apply the on drop script, and then click OK.
For a diagram, the script is run when an item is dropped or moved on the diagram in the diagram editor. For an item, the script is run when another item is moved or copied on to the item in a pane.
5. Click the Settings tab.
6. In the Script Type list, select OnDrop.
7. Click the Script tab.
8. In the box, type the script you want to run after an item has been dropped on to the item or diagram.
If you want to change the text in a larger window with the Text Format Toolbar available, click the Editor button.
Write the script within the ValidDrop and OnDrop functions. For more information about working with scripts:
Script functions, attributes and objects - on drop scripts for diagrams
Script functions, attributes and objects - on drop scripts for items
Script functions, attributes and objects - overview
Script template for on drop scripts for diagrams
Script template for on drop scripts for items
For items, the script will be run whenever an item is dropped on to a valid item in a pane.
For diagrams, the script will be run whenever the following drag-and-drop operations are performed on a valid diagram in the diagram editor:
An item is dragged to the diagram from a pane.
A symbol is moved on the diagram, including the reconnection of a link.
* 
If a valid diagram was open while creating the Script, that diagram will not use the Script until it is closed and then opened again.