W
weiterfahrn
Neues Mitglied
Thread Starter
- Dabei seit
- 29.08.2006
- Beiträge
- 15
- Reaktionspunkte
- 1
Da iphoto diese funktion (aus mir unverständlichen gründen) nicht mitliefert, iphoto diet nicht mehr geht und dublicate annihilator geld kostet, hab ich mir das anhängende apple script selbst geschrieben: Es entfernt doppelte fotos. Zuerst zählt es alle fotos in der iphoto-bibliothek. beginnend mit dem letzten foto vergleicht er dieses mit seinem vorgänger, falls der name und die abmessungen gleich sind wird das letzte gelöscht, usw. Bei vielen fotos nimmt es eine gewisse zeit in anspruch, aber es funktioniert und kost nix. viel spaß damit.
p.s.: optional kommt jeweils noch ein bestätigunsdialog (kommentare verändern)
p.s.: optional kommt jeweils noch ein bestätigunsdialog (kommentare verändern)
Code:
-----------------------------
--use on your own risk--
-----------------------------
-----------------------------
set the_album to "Photos"
set deletecounter to 1
set logged to 0
tell application "iPhoto"
set item_count to count of photo of album the_album
set n to item_count
repeat with m from 2 to item_count
set item_present to image filename of item n of photo of album the_album
set item_previous to image filename of item (n - 1) of photo of album the_album
set id_previous to id of item (n - 1) of photo of album the_album
------------------------
--same name?
------------------------
if item_present = item_previous then
------------------------
--same dimensions?
------------------------
if (dimensions of item n of photo of album the_album = dimensions of item (n - 1) of photo of album the_album) then
--option: without prompt
--comment next line for option
-- set dialog_return to button returned of (display dialog ("Delete \"" & item_present & "\" from iPhoto?") buttons {"Cancel", "Do not delete", "OK"} default button {"Ok"})
--comment next line for option
-- if dialog_return = "OK" then --comment these line for option
remove (every photo whose id is id_previous)
set logged to ((item_present as string) & return as Unicode text) & (logged)
set deletecounter to deletecounter + 1
--comment next line for option
-- end if
end if
end if
set n to n - 1
end repeat
set logged to (logged & return as Unicode text) & "Files moved to trash: "
display dialog "" & deletecounter & " items moved to trash."
------------------------
---write logfile
------------------------
set Desktopfolder to (path to home folder as text)
set Desktopfolder to Desktopfolder & "Desktop:deleted_duplicates_log.txt"
set RefNum to (open for access file Desktopfolder with write permission)
set eof of RefNum to 0 --alles überschreiben
try
write logged to RefNum
close access RefNum
on error
close access RefNum
end try
end tell