Why does this iPhoto applescript fail to produce new albums with photos in them?
Why does this iPhoto applescript fail to produce new albums with photos in them?
- Subject: Why does this iPhoto applescript fail to produce new albums with photos in them?
- From: "Andrew T. Lynch" <email@hidden>
- Date: Wed, 9 Mar 2005 17:13:44 -0800
Hello as gurus,
I want to automatically create albums of 48 (the current iphoto home
page limit) images from a larger selection, which I will then publish
to my home page. This script seems to run, but the resulting albums
created have no images in them. I tried doing this adding one image
at a time to the new albums, and it worked, but it took 6 seconds per
image added (on a 1Ghz pbook).
Any Clues?
Thanks Much,
Drew
tell application "iPhoto"
set albumcount to 0
copy (my selected_images()) to the thePhotos
if the thePhotos is false then error "Please select some images."
set theCount to the count of thePhotos
set iStart to 1
set iEnd to 48
repeat while iStart is less than or equal to theCount
set albumcount to albumcount + 1
set albumname to "Page " & albumcount
new album name albumname
set theAlbum to album albumname
if iEnd is greater than theCount then
set iEnd to theCount
end if
add (items iStart thru iEnd of thePhotos) to theAlbum
set iStart to iStart + 48
set iEnd to iEnd + 48
end repeat
end tell
on 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
- Andrew T. Lynch
- Chief Zymurgist
- Verisity Design Inc.
- (650)934-6875
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden