Created
August 11, 2011 21:52
-
-
Save seancoyne/1140889 to your computer and use it in GitHub Desktop.
Applescript for iChat Growl (1.2.2) Notiifications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on notify_growl(theName, theTitle, theDescription, theImage) | |
tell application "GrowlHelperApp" | |
notify with name theName title theTitle description theDescription application name "iChat" image theImage | |
end tell | |
end notify_growl | |
using terms from application "iChat" | |
-- register the app with growl | |
tell application "GrowlHelperApp" | |
set the allNotificationsList to {"Message Received"} | |
set the enabledNotificationsList to {"Message Received"} | |
register as application "iChat" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "iChat" | |
end tell | |
-- handle the iChat events | |
on message received theMessage from theBuddy for theChat | |
if ((application "iChat" is not frontmost) or (status of application "iChat" is equal to away)) then | |
notify_growl("Message Received", "Message Received from " & name of theBuddy, theMessage, image of theBuddy) | |
end if | |
end message received | |
on received text invitation theMessage from theBuddy for theChat | |
accept theChat | |
if ((application "iChat" is not frontmost) or (status of application "iChat" is equal to away)) then | |
notify_growl("Message Received", "Message Received from " & name of theBuddy, theMessage, image of theBuddy) | |
end if | |
end received text invitation | |
end using terms from |
Updated to also notify growl if the status is set to away (in case you set it to away, then leave, iChat may still be the frontmost application)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use simply place this script in your ~/Library/Scripts/iChat directory and select it as the Applescript to run for the "Message Received" and "Text Invitation" events in the iChat preferences. Tested on Mac OS X Lion 10.7.0