Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

List of albums from iPhoto

Hi,

There's really two questions here. The first is the specific technical one - how do I get a list of event albums from iPhoto?

The second question is how do you use the applescript dictionary for iPhoto? I'm sure it must mean something to someone skilled in applescript (but thats not me!). I've read through the dictionary and it's not obvious how I could use the available keywords to retrieve a list of all the event albums. Is there a primer somewhere?

Thanks for your help.

Andy

15" early MacBook Pro 2.16GHz, 2GB Ram, Mac OS X (10.6.2), It's my first Mac and I love it!

Posted on Jan 11, 2010 12:11 PM

Reply
Question marked as Best reply

Posted on Jan 11, 2010 12:46 PM

how do I get a list of event albums from iPhoto?


Unfortunately I think you're largely out of luck here.

You can certainly ask iPhoto for the Events Album:

tell application "iPhoto"
set theAlbum to events album
end tell


but this just returns the smart album 'Events'. There's no deeper AppleScript integration to determine specific events within the album. You can get the photos "... photos of theAlbum", but that doesn't break them into events.

Given the above, the second question is kind of moot:

how I could use the available keywords to retrieve a list of all the event albums


Simple - you can't. There is only one event album that contains all the events, but you can't (easily) extract specific events from within that album. An oversight on Apple's part, for sure.

The best you can do is filter the images within the album on some other criteria - for example if there are specific dates or if you've tagged the images with a specific keyword.
7 replies
Question marked as Best reply

Jan 11, 2010 12:46 PM in response to Andy E

how do I get a list of event albums from iPhoto?


Unfortunately I think you're largely out of luck here.

You can certainly ask iPhoto for the Events Album:

tell application "iPhoto"
set theAlbum to events album
end tell


but this just returns the smart album 'Events'. There's no deeper AppleScript integration to determine specific events within the album. You can get the photos "... photos of theAlbum", but that doesn't break them into events.

Given the above, the second question is kind of moot:

how I could use the available keywords to retrieve a list of all the event albums


Simple - you can't. There is only one event album that contains all the events, but you can't (easily) extract specific events from within that album. An oversight on Apple's part, for sure.

The best you can do is filter the images within the album on some other criteria - for example if there are specific dates or if you've tagged the images with a specific keyword.

Jan 11, 2010 8:32 PM in response to Andy E

Maybe the script below could get a list of the events in your Events Album. It sometimes (but not always) works well on my computer, but since it uses [GUI scripting|http://www.macosxautomation.com/applescript/uiscripting/index.html], I'm not sure at all that it will work on yours. Nothing to lose by trying however. You might just copy and paste the script into the AppleScript Editor and launch it.

tell application "iPhoto"
activate
select the photo library album -- just to reset the process
select the events album
tell application "System Events" to tell process "iPhoto"
set SG to splitter group 1 of splitter group 1 of group 1 of window 1
set theText to value of text field 1 of row 2 of outline 1 of scroll area 1 of SG
set N to text 9 through -2 of theText as integer
if not (static text of SG exists) then click button 2 of window 1 -- button ⓘ
set theList to {}
repeat N times
key code 124 -- right arrow
copy value of text field 1 of SG to the end of theList
end repeat
end tell
end tell
theList

And maybe it would be a good idea to quit iPhoto before launching the script.

Message was edited by: Pierre L.

Jan 16, 2010 2:29 PM in response to Andy E

Although you have marked this topic as answered, here's a slightly improved version of my previous script, which seems to work properly +most of the time+ and no longer requires that the “Show item counts” box be checked in the General preferences of iPhoto before launching the script.

tell application "iPhoto"
activate
delay 1 -- adjust if necessary
select the events album
tell application "System Events" to tell process "iPhoto"
keystroke "a" using {shift down, command down} -- select none
set SG to splitter group 1 of splitter group 1 of group 1 of window 1
if not (static text of SG exists) then click button 2 of window 1 -- button ⓘ
set numberOfEvents to value of static text 9 of SG
set N to word 1 of numberOfEvents
set theList to {}
repeat N times
key code 124 -- right arrow
copy value of text field 1 of SG to the end of theList
end repeat
end tell
theList
end tell

Message was edited by: Pierre L.

List of albums from iPhoto

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.