Question

I'm trying to get at the name of the album with applescript/iphoto. So far I've got this

tell application "iPhoto"
activate
set theEvents to get every album
repeat with aEvent in theEvents
    log name of aEvent
end repeat
end tell

but when it prints the names I get this :

(*name of album id 6.442450942E+9*)
(*name of album id 6.442450941E+9*)
(*name of album id 6.44245094E+9*)

not quite what i wanted. I'm quite new to applescript so I suspect something basic is going wrong, but the few examples I've seen on line seem to do something like this. any help appreciated.

UPDATE

may have found answer. I've seen hints that it's not possible to directly access the Event Name with applescript unlike an albums name (seems silly to me, but that's what I've found at the moment)

Was it helpful?

Solution

Try this:

tell application "iPhoto"
activate
set theEvents to get every album
repeat with aEvent in theEvents
    log (get name of aEvent)
end repeat
end tell

The log command does not implicitly dereference the object specifier you are passing. Adding a get command does this.

OTHER TIPS

The Answer #1, has already been accepted but I wanted to post this for future readers.

    tell application "iPhoto" to set theEvents to get name of every album


    #You can then use the theEvents list.


    #Example - log  items of theEvents 
    log theEvents
--> {"Events", "Faces", "Places", "Photos", "Last 12 Months", "Last Import", "Flagged","Trash", "My Photo Stream", "Holiday 2008", "Holiday Sep 2008"}



    #Example -  work though the items of theEvents with a repeat loop

    repeat with i from 1 to number of items in theEvents
        set this_item to item i of theEvents
        if this_item contains "Holiday" then
            log this_item
-->(*Holiday 2008*)
-->(*Holiday Sep 2008*)
        end if
    end repeat
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top