DIY GrowlMail for Leopard

I was completely unable to figure out from a cursory Google search whether GrowlMail had ever been fixed for Leopard, so I spent an hour writing my own script rather than waste five more minutes seeing if it had been done before.

Added bonus: I hate seeing Growl notifications litter my screen when I’m actually staring at Mail.app, so this script does a check and only growls at you if Mail is not frontmost. I’d actually prefer it to not growl if I’m in the same Space as Mail.app, but I’m not insane enough to try coding that right now.

Code below, or download the attachment to this post. If you’re not sure how to attach an AppleScript rule to an incoming Mail message, here’s a good description.

on perform_mail_action(theData)

tell application “Mail”

set theSelectedMessages to |SelectedMessages| of theData

set theRule to |Rule| of theData

tell application “System Events” to set currApp to name of item 1 of (processes whose frontmost is true)

if currApp ? “Mail” then

repeat with a from 1 to count theSelectedMessages

do shell script “/usr/local/bin/growlnotify -a ‘Mail.app’ -m ‘” & subject of item a of theSelectedMessages & “‘ ‘” & sender of item a of theSelectedMessages & “‘”

end repeat

end if

end tell

end perform_mail_action

 

Attachment: DIY GrowlMail.scpt.zip

Leave a Reply

Your email address will not be published. Required fields are marked *