Omdat iPhoto 4 erg goed zou zijn en beter samenwerkt met andere iApps, heb ik besloten mijn hele digitale fotocollectie (en dat zijn er nogal wat) in iPhoto 4 te beheren inplaats van iView Media Pro dat ook niet zonder gekke fouten zit.
Mijn Canon digitale camera levert JPEG's met de naam IMG_3809.JPG en omdat ik alles sorteer op fotonummer en dat IMG_ en .JPG wel geloof, wil ik de titel van de foto's na import veranderen naar 3809.
Simpel. Je schrijft een AppleScript dat de filenaam bekijkt, de IMG_ en de JPG er af sloopt en het in het titelveld stopt. Uurtje werk, testen, draaien, klaar. Of toch niet? Want na het stoppen en weer starten van iPhoto zijn de meeste titels helemaal leeg (ik heb in het View-menu de titels aanstaan, maar ik zie ze niet meer in het sorteer-scherm).
Is dit in een bug in mijn AppleScript of is dit een bug in iPhoto 4? Ik denk het laatste. Graag jullie oordeel. Test dit ook eens. Overigens werkt de Batch-change die in iPhoto zit wel prima, dus ik kan de boel weer in de oorspronkelijke situatie terugkrijgen.
Laat jullie kundig oog er eens over schijnen!
Toivo.
tell application "iPhoto"
activate
copy (my selected_images()) to these_images
if these_images is false then ¬
error "Please select the images to include in the summary."
-- images are selected, get confirmation for changing titles
set the image_count to the count of these_images
display dialog "Reset " & (image_count as string) & " titles to image numbers?"
-- do loop to get the filenames of each of the images
repeat with i from 1 to the image_count
set this_photo to item i of these_images
tell this_photo
set the image_title to the image filename as string
-- strip JPEG suffix
if the image_title ends with ".JPG" then ¬
set the image_title to text 1 thru (the (length of image_title) - 4) of image_title
-- strip Canon prefix
if the image_title starts with "IMG_" then ¬
set the image_title to text 5 thru (the length of image_title) of image_title
-- strip Sony prefix
if the image_title starts with "DSC" then ¬
set the image_title to text 4 thru (the length of image_title) of image_title
set the title to the image_title
end tell
end repeat
display dialog "Done!"
end tellon selected_images()
tell application "iPhoto"
try
-- get selection
set these_items to the selection
-- check for single album selected
if the class of item 1 of these_items is album then error
-- return the list of selected photos
return these_items
on error
return false
end try
end tell
end selected_images