We've finished our move from .Mac to our very own domain name: http://www.brettgrossphotography.com/ .

Woo hoo!




Choose Project/Album 01

Current version: 01
Built on: Aperture 1.5.2
This is a reusable AppleScript subroutine.


This AppleScript subroutine can be used to allow a user to choose a particular Aperture project or album. It is flexible enough to allow selection of either an album or a project. It cannot at this time select root-level albums (ie smart albums at the Library level).

Download




on run
tell application "Aperture"
set m_theSource to my chooseProjAlbum()

set m_theKind to (class of m_theSource) as string

set m_srcName to name of m_theSource
--
set m_numImgs to count of image versions of m_theSource
end tell

display dialog ("You chose the " & m_theKind & space & m_srcName) buttons {"OK"} default button 1
--
display dialog ("Images in " & (name of m_theSource) & ": " & m_numImgs) buttons {"OK"} default button 1
end run

on chooseProjAlbum()
tell application "Aperture"
set theLib to library 1

set theProjects to projects
set theProjectsNames to {}
repeat with curProject in theProjects
set end of theProjectsNames to name of curProject
end repeat

tell AppleScript to set theOut to choose from list theProjectsNames with prompt "Choose a project:"
set theProject to project (item 1 of theOut)
--
set theProject to project "Bretts Portfolio"

set theAlbums to albums of theProject
if theAlbums is {} then
set theAlbum to theProject

else
set formProjName to ("<" & (name of theProject) & ">")
set theAlbumNames to {formProjName}
repeat with curAlbum in theAlbums
set end of theAlbumNames to name of curAlbum
end repeat

tell AppleScript to set theOut to choose from list theAlbumNames with prompt "Choose an album or the project:"

if ((item 1 of theOut) = (item 1 of theAlbumNames)) then
set theAlbum to theProject
else
set theAlbum to album (item 1 of theOut) of theProject
end if
end if

return theAlbum
end tell
end chooseProjAlbum