You write scripts for menu items in the Script view. The scripts specify what happens when users select a menu item.
To write a script for a menu item:
Double-click the menu item or select Script from the menu item’s pop-up menu.
The Script view displays for the clicked event, which is the default event for a menu item.