Empty iPhoto trash

Hi,
I work on a project where I need to empty the iPhoto trash. It seems very trivial:


tell application "iPhoto"
	empty trash
end tell

However, this only seems to works if I have manually clicked on the iPhoto trash in iPhoto before I run the script. In older versions of iPhoto this worked flawlessly but in iPhoto 9 it no longer works.

Any ideas?

I’ve noticed the same issue with the trash album in iPhoto so…


tell application "iPhoto"
	
	tell trash album
		set trashlist to name of photos
	end tell
	
	return trashlist
end tell

…returns an empty list if I have not first clicked on the iPhoto trash in iPhoto. After clicking on the trash the list populates.

The problem is that my script moves photos to the trash and having to manually click in iPhoto for the script to work kind of makes the script pointless.

Hi,

maybe it’s a workaround to select the trash album programmatically


tell application "iPhoto"
	select trash album
	empty trash
end tell

:smiley: Brilliant!