I too would like to be able to do this. With iPhoto '09, you can double-click on an iPhoto Library to open it, however Hazel has iPhoto libraries grayed out when I attempt to open one with the "Open file" action.
I found an
AppleScript to open up a specific iPhoto Library, however when I run it it brings up the iPhoto '09 "Library chooser" window which puts a halt to any automation.
If we could just get Hazel to allow opening of the iPhoto '09+ library files, that would be ideal. Otherwise, perhaps some AppleScript guru could shed some light on how to modify that script so we can bypass the "Library chooser" window.
Here's the AppleScript for easy reference:
- Code: Select all
--http://maeks84.wordpress.com
property libraryPath : "Macintosh HD:User:File:Path:To:iPhoto Library"
--Determine if iPhoto is open and needs to be quit
--Will only bring iPhoto to the front if the correct library is already open
tell application "System Events"
if exists process "iPhoto" then --Only worries about the current user
tell application "iPhoto"
if image path of photo 1 does not contain POSIX path of libraryPath then
activate
beep
display dialog "About to quit iPhoto!" giving up after 60 --Gives a chance to cancel otherwise continues on
quit
tell application "System Events"
repeat while exists process "iPhoto"
delay 3
end repeat
end tell
my launch_library()
else
activate
end if
end tell
else --iPhoto is not currently running
my launch_library()
end if
end tell
on launch_library()
do shell script "defaults write com.apple.iPhoto RootDirectory " & quoted form of POSIX path of libraryPath
tell application "iPhoto" to activate
tell application "System Events"
repeat while (exists process "iPhoto") is false --Delay until iPhoto is launched
delay 5
end repeat
end tell
do shell script "defaults remove com.apple.iPhoto RootDirectory" --Restore the default library
end launch_library