Have you heard of RubyOSA? It is a free software that retrieves the scriptable definition of of a given application and populates a new Ruby namespace with classes, methods, constants, enumerations, and all other elements described by the terminology.

For better understanding, most Mac OS X applications are scriptable, and they define their scriptable interface in an XML format. RubyOSA parses this file and creates the Ruby API on the fly. This API will do the necessary AppleEvent work transparently for you (building and sending events).

RubyOSA can be an alternative to the RubyAEOSA project. The latter is more a set of Ruby bindings for the AppleEvent C API, while RubyOSA is a more high-level framework as the AppleEvent infrastructure is completely hidden.