Integrating Sparrow and Aperture/iPhotofrom 2012/04/13
In my recent quest to take on digital photography, I've been using Apple's Aperture to store download my pictures and do basic manipulation on them. It's been working great, except that emailing is a pain because Apple hardcoded the email clients to:
So all I needed to do is replace /Applications/Aperture.app/Contents/PlugIns/Mail.applescript with the following script:
-- Mail from Sparrow.app instead of Mail.app
-- Travis Johnson (traviscj@traviscj.com)
on mail_images(email_subject, default_address, image_count, new_files, ¬
new_captions, new_comments, cancel_string)
try
tell application "Sparrow"
activate
set theMessage to make new outgoing message with properties {¬
subject:email_subject, ¬
content:"Check out my sweet pictures!"}
tell theMessage
repeat with image_idx from 1 to image_count
set this_imagefile to item image_idx of new_files
set attachmentfilename to POSIX file this_imagefile
make new mail attachment with properties {¬
filename:attachmentfilename as alias}
end repeat
compose
end tell
end tell
on error error_message number error_number
log error_message & " " & error_number
if the error_number is not -128 then
tell application "Finder"
beep
display dialog error_message buttons {cancel_string} ¬
default button 1
end tell
end if
end try
end mail_images
Now, magically, I can press the 'Email’ button in Aperture, and Sparrow pops up with a new email, and the proper file attached! Hooray! I looked into doing the same thing with iPhoto; a slightly different proceedure is needed here. I opened /Applications/iPhoto.app/Contents/Resources/Scripts/Mail.scpt with Script Editor via the terminal: $ open /Applications/iPhoto.app/Contents/Resources/Scripts/Mail.scpt then pasted in the above code, clicked 'Compile’, then 'Save’. iPhoto then worked as expected, opening a new Sparrow message with the files attached. |