This article is from the Mac Programming FAQ, by Jon Watte firstname.lastname@example.org with numerous contributions by others.
AppleEvents are the meat and potatoes of AppleScript. If you support
the AppleEvent Object Model from within your application, users can
control you through AppleScript.
The first thing you should do is get ahold of Inside Mac:
Interapplication Communication, and a copy of the AppleEvents Registry.
The former tells you all you ever need to know about AppleEvents, while
the latter is paramount for implementing the right standard events. If
everybody use the standard events, dynamic data interchange between any
applications will become sweet reality!
Then there is the 'aete' resource which lets you put names on the events
you support, so that users can "Open Terminology" on your application
from within the Apple Script Editor and use the proper AppleScript
commands in their scripts. The format of an aete resource is defined in
Inside Macintosh: Interapplication Communication.