UI Actions -"Universal Attachability" for AppleScript.
UI Actions brings "universal attachability" to AppleScript, greatly enhancing your control over applications running on your computer. Attach a UI Action script to any standard native Mac OS X application, and UI Actions automatically runs the script whenever you perform specified user actions in the target application.
You write the script, and you select the user action that triggers it, such as choosing a menu item, changing the value of a text field, opening a drawer or window, or activating an application.
UI Actions is a scriptable faceless background application, enabling you to use AppleScript commands to attach and detach UI Action scripts, to export and import sets of UI actions, to enable and disable them, and to get a reference to the affected UI element for use in your UI Action scripts.
The included UI Actions Setup application works with UI Actions. It provides a convenient graphical user interface to attach UI Action scripts to applications and to manage all of your UI Action scripts.