http://www.macdevcenter.com/pub/a/mac/2003/05/28/iphoto2.html

great information on automation