GrowlNotify
Show nice notify popups on incoming emails.
Inhaltsverzeichnis |
What is this Script good for?
This Apple-script is an replacement of the growlnotify.sh script with the benefit that it uses the pictures of your Addressbook instead of simply showing the Thunderbird-icon if a new email arrives.
To make this script work, you need growl , Thunderbird and Yamb installed on your mac.
Who did NOT need this script
- If you don't have a apple mac, this script is useless.
- If you don't use Thunderbird, you don't need it
Download
you can download this script here (DOWNLOAD)
Installation
You can find an Howto here (german)
File
| Datei: growlNotify.scpt |
(*
by Michael Vöhringer [michael (at) voehringer dot net]
based on the Mail Advanced script from growl (www.growl.info)
to install enter "osascript /PATH_TO_SCRIPT/growlNotify.scpt" in the Yamb prefereces
Note: If you have problems with unicode characters please install textcommands from http://osaxen.com/files/textcommands1.1.3.html
*)
to getPictureForEmailAddress(personEmailAddress)
tell application "Address Book"
try
set thePerson to (first person where the value of emails contains personEmailAddress)
set thePiccy to image of thePerson
return thePiccy
end try
end tell
end getPictureForEmailAddress
on run argv
tell application "GrowlHelperApp"
try
tell application "TextCommands"
repeat with itemRef in argv
set itemRef's contents to convert to unicode itemRef from "utf8"
end repeat
end tell
end try
set appName to "Thunderbird Notification Script"
set theSubject to item 1 of argv
set theSendersName to item 2 of argv
set theMessageSize to item 4 of argv as integer
if (theSendersName does not contain "<" or theSendersName does not contain ">") then
set theSendersAddress to theSendersName
else
-- Name and email is set, so extract the mail address
set beginEmail to offset of "<" in theSendersName
set beginEmail to beginEmail + 1
set endEmail to offset of ">" in theSendersName
set endEmail to endEmail - 1
set theSendersAddress to text beginEmail thru endEmail of theSendersName
end if
-- Get picture from address book
set thePersonsPicture to my getPictureForEmailAddress(theSendersAddress)
-- Format Message
if theMessageSize > 1024 and theMessageSize < 1048576 then
set theMessageSize to ((theMessageSize / 1024) as integer) & " KB"
else if theMessageSize > 1048576 then
set theMessageSize to ((theMessageSize / 1048576) as integer) & " MB"
else
set theMessageSize to theMessageSize & " B"
end if
set theTitle to "From: " & theSendersName
set theMessage to "Subject: " & theSubject & "
Size: " & theMessageSize
-- Show notification
set myAllNotesList to {"Mail Received"}
register as application appName all notifications myAllNotesList default notifications myAllNotesList icon of application "Thunderbird.app"
try
notify with name "Mail Received" title theTitle description theMessage application name appName image thePersonsPicture
on error the errorMessage -- user without picture in adressbook
notify with name "Mail Received" title theTitle description theMessage application name appName icon of application "Thunderbird.app"
end try
end tell
end run
|
