Created
June 3, 2012 05:38
-
-
Save informationsea/2862076 to your computer and use it in GitHub Desktop.
iChat notify with Growl
This file contains 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
-- Put at "~/Library/Scripts/iChat" | |
on showgrowl(theNotify, theImage, theTitle, theMessage) | |
tell application "Growl" | |
-- Make a list of all the notification types | |
-- that this script will ever send: | |
set the allNotificationsList to ¬ | |
{"Login", "Logout", "Present", "Text Message", "Invitation"} | |
-- Make a list of the notifications | |
-- that will be enabled by default. | |
-- Those not enabled by default can be enabled later | |
-- in the 'Applications' tab of the growl prefpane. | |
set the enabledNotificationsList to ¬ | |
{"Login", "Logout", "Present", "Text Message", "Invitation"} | |
-- Register our script with growl. | |
-- You can optionally (as here) set a default icon | |
-- for this script's notifications. | |
register as application ¬ | |
"iChat" all notifications allNotificationsList ¬ | |
default notifications enabledNotificationsList ¬ | |
icon of application "iChat" | |
try | |
notify with name theNotify title theTitle description theMessage application name "iChat" image theImage | |
on error msg | |
notify with name theNotify title theTitle description theMessage application name "iChat" -- image from location "/Applications/iChat.app/Contents/Resources/silhouette.png" | |
end try | |
end tell | |
end showgrowl | |
using terms from application "iChat" | |
on buddy became available theBuddy | |
set hisname to name of theBuddy | |
set hisimage to image of theBuddy | |
showgrowl("Login", hisimage, hisname & " Avaiable", hisname & " becomes avaiable for chat.") | |
end buddy became available | |
on buddy became unavailable theBuddy | |
set hisname to name of theBuddy | |
set hisimage to image of theBuddy | |
showgrowl("Logout", hisimage, hisname & " Unavaiable", hisname & " becomes unavaiable for chat.") | |
end buddy became unavailable | |
on message received theText from theBuddy for theChat | |
set hisname to name of theBuddy | |
set hisimage to image of theBuddy | |
showgrowl("Text Message", hisimage, "Text Message Received", "Received text message from " & hisname & " | |
" & theText) | |
end message received | |
on received text invitation theText from theBuddy for theChat | |
set hisname to name of theBuddy | |
set hisimage to image of theBuddy | |
showgrowl("Invitation", hisimage, "Text Message Invitation Received", "Received text invitation from " & hisname & " | |
" & theText) | |
end received text invitation | |
on received audio invitation from theBuddy for theChat | |
set hisname to name of theBuddy | |
set hisimage to image of theBuddy | |
showgrowl("Invitation", hisimage, "Audio Chat Invitation Received", "Audio chat invitation from " & hisname) | |
end received audio invitation | |
on received video invitation from theBuddy for theChat | |
set hisname to name of theBuddy | |
set hisimage to image of theBuddy | |
showgrowl("Invitation", hisimage, "Video Chat Invitation Received", "Video chat invitation from " & hisname) | |
end received video invitation | |
on received local screen sharing invitation from theBuddy for theChat | |
set hisname to name of theBuddy | |
set hisimage to image of theBuddy | |
showgrowl("Invitation", hisimage, "Local Screen Sharing Invitation Received", " Local screen invitation from " & hisname) | |
end received local screen sharing invitation | |
on received remote screen sharing invitation from theBuddy for theChat | |
set hisname to name of theBuddy | |
set hisimage to image of theBuddy | |
showgrowl("Invitation", hisimage, "Remote Screen Sharing Invitation Received", "Remote screen sharing invitation from " & hisname) | |
end received remote screen sharing invitation | |
on received file transfer invitation theFileTransfer | |
set theBuddy to buddy of theFileTransfer | |
set hisname to name of theBuddy | |
set hisimage to image of theBuddy | |
showgrowl("Invitation", hisimage, "File Transfer Invitation Received", "File Transfer Invitation from " & hisname) | |
end received file transfer invitation | |
end using terms from |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment