Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A GrowlMail alternative' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A GrowlMail alternative
Authored by: Frig on Dec 07, '10 10:46:13AM

I've extended the Applescript to use the native Applescript Interface of GrowlHelperApp to display notifications. With this method the notification also contains a Mail icon instead of a Terminal icon and the content of the message.

Feel free to extend, modify and use this script!


using terms from application "Mail"
	on perform mail action with messages theMessages for rule theRule
		set maxlen to 200
		
		set the notificationList to {"new Mail"}
		tell application "GrowlHelperApp"
			register as application ¬
				"myGrowlMail" all notifications notificationList ¬
				default notifications notificationList ¬
				icon of application "Mail"
			--notify with name "new Mail" title "TEST title" description "langer text" application name "myGrowlMail"
		end tell
		
		tell application "Mail"
			repeat with m in theMessages
				set sub to m's subject
				set sndr to m's sender
				set msgtxt to m's content
				if ((length of characters of msgtxt) > maxlen) then
					set AppleScript's text item delimiters to ""
					set msgtxt to (text items of characters 1 thru maxlen of msgtxt) & " ..."
				end if
				set msg to sub & " from " & sndr
				
				
				tell application "GrowlHelperApp" to ¬
					notify with name ¬
						"new Mail" title msg ¬
						description "" & msgtxt ¬
						application name "myGrowlMail"
				
				--do shell script "/usr/local/bin/growlnotify -I /Applications/Mail.app -m " & quoted form of msg & quoted form of msgtxt
			end repeat
		end tell
	end perform mail action with messages
end using terms from


[ Reply to This | # ]