Search code examples
applescriptiphoto

how to get name of iphoto album


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)


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.