I have zero experience with AppleScript although it seems like this SHOULD be a rather trivial enhancement.
Here's a really cool script by Matt Gemmell (mattgemmell.com) that provides Outlook 2011 Growl notifications.
The only issue is that when you start Outlook after not pulling down for a while you're bombarded with a notification for every new email received and occasionally Outlook chokes because of it.
Ideally, I'm looking to provide it with the Twitter-like behavior where if there's more then x number of notifications (let's say 5) it'll only throw up ONE notification indicating that there are x notifications. Assuming this is possible, if anyone would be willing to point me in the right direction (or make the mod) I'd be greatly appreciative (as probably would everyone using this script). There is an included option to only throw the last one, but I frequently get more then one email at a time so that won't cut it.
Here's the code:
Here's a really cool script by Matt Gemmell (mattgemmell.com) that provides Outlook 2011 Growl notifications.
The only issue is that when you start Outlook after not pulling down for a while you're bombarded with a notification for every new email received and occasionally Outlook chokes because of it.
Ideally, I'm looking to provide it with the Twitter-like behavior where if there's more then x number of notifications (let's say 5) it'll only throw up ONE notification indicating that there are x notifications. Assuming this is possible, if anyone would be willing to point me in the right direction (or make the mod) I'd be greatly appreciative (as probably would everyone using this script). There is an included option to only throw the last one, but I frequently get more then one email at a time so that won't cut it.
Here's the code:
Code:
-- Register a notification type called "New Mail" with Growl, and enable it.
tell application "GrowlHelperApp"
set the allNotificationsList to {"New Mail"}
set the enabledNotificationsList to {"New Mail"}
register as application ¬
"Outlook" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "Microsoft Outlook"
end tell
-- Get a list of all "current messages" in Outlook.
tell application "Microsoft Outlook"
set theMessages to the current messages
end tell
-- Loop through the messages.
repeat with theMsg in theMessages
tell application "Microsoft Outlook"
-- Only Growl about unread messages.
if is read of theMsg is false then
set growl to true
set mysubject to get the subject of theMsg
set mysender to sender of theMsg
set mycontent to content of theMsg
-- Get an appropriate representation of the sender; preferably name, but fall back on email.
try
if name of mysender is "" then
set mysender to address of mysender
else
set mysender to name of mysender
end if
on error errmesg number errnumber
try
set mysender to address of mysender
on error errmesg number errnumber
-- Couldn't get name or email; we'll just say the sender is unknown.
set mysender to "Unknown sender"
end try
end try
else
-- The message was already read, so we won't bother Growling about it.
set growl to false
end if
end tell
-- Tell Growl to show our "New Mail" notification, with a custom title and description.
if growl is true then
tell application "GrowlHelperApp"
notify with name "New Mail" title "Mail from " & mysender description ("\"" & mysubject & "\"") application name "Outlook" --identifier "New Mail"
-- If you want multiple notifications to replace each other (i.e. only show one notification at a time, with newer ones replacing the older ones), uncomment the last part of the line above to make Growl coalesce the notifications.
end tell
end if
end repeat