Script to delete oldest photo in iPhoto MobileMe gallery

I’m a total applescript noob, hopefully I can explain myself adequately. I’m currently using iPhoto and MobileMe to host photo that are created by another application. I’ve already used a combination of Automator and Applescript to import and organize photos into iPhoto when they are created by this other application. I’m running into a problem, because MobileMe galleries only support a maximum of 500 photos per gallery. I am trying to auto delete the oldest photo every time a new photo is imported using an applescript. I have successfully created a script that removes photos from the gallery, but only if I tell it the name of the photo to remove see here:


tell application "iPhoto"
	select album "recent"
	
	
	remove photo "p_000196"
	
end tell

I assume that I need to use the Date property, but I’m not sure how to tell the script to choose the “oldest” photo to remove. The only thing I can think of is an if/then loop that checks through all the photos, but again this is beyond my abilities. Any advise would be greatly appreciated. Thanks. -Nick