Have a relative that would like to automate a “cleanup” of iPhoto.
One of the things I’d like to automate is deleting the empty albums they somehow keep creating.
I’ve almost got this, but can’t figure out how to tell iPhoto to delete an empty album - could use a hint -
tell application "iPhoto"
activate
set theAlbums to get name of every album
repeat with xal in theAlbums
tell album xal
try
set photoCnt to count of photos
on error theError
set photoCnt to "0" as text
end try
try
if photoCnt is not 0 then
--do nothing
display dialog "Photo Count of album " & xal & ":" & space & photoCnt
else
delete album xal of me
display dialog "Deleted empty album " & xal
exit repeat
end if
on error theError
display dialog theError
end try
end tell
end repeat
end tell
It’s these two lines that keep failing:
delete album xal of me
display dialog "Deleted empty album " & xal