Skip to content

Instantly share code, notes, and snippets.

@drudge
Created January 26, 2010 17:57
Show Gist options
  • Save drudge/287048 to your computer and use it in GitHub Desktop.
Save drudge/287048 to your computer and use it in GitHub Desktop.
(*
* Entourage Mail.script
* Misc. Scripts
*
* Created by Nicholas Penree on 1/26/10.
* Copyright 2010 Conceited Software. All rights reserved.
*)
tell application "GrowlHelperApp"
set the allNotificationsList to {"New Mail"}
set the enabledNotificationsList to {"New Mail"}
register as application ¬
"Entourage" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "Microsoft Entourage"
end tell
tell application "Microsoft Entourage"
set theMessages to the current messages
end tell
repeat with theMsg in theMessages
tell application "Microsoft Entourage"
set msgSubject to get the subject of theMsg
set msgSender to the display name of sender of theMsg as string
set msgBody to the content of theMsg
set msgLen to the length of msgBody
-- Truncate message if needed
if msgLen > 80 then
set msgBody to get text 1 through 80 of msgBody
set msgBody to msgBody & "…"
end if
-- Fallback to email if no display name is given
if msgSender is "" then
set msgSender to the address of sender of theMsg as string
end if
end tell
tell application "GrowlHelperApp"
notify with name "New Mail" title msgSubject description (msgSender & (ASCII character 7) & msgBody) application name "Entourage"
end tell
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment