PreFab UI Actions
With UI Actions, you attach a script to a native Mac OS X application, and the script will be triggered automatically by user actions you specify, such as opening or closing a window, selecting a menu item, editing a text field and many others. An attached script can query the target application for useful information about the user action that triggered it, including a reference to the affected UI element and all of its attributes such as position, size, title, role and value. Using this information, every attached script can draw upon the full capabilities of AppleScript, including Apple’s new GUI Scripting, to amplify and enhance the power of the target application.