Skip to content

Instantly share code, notes, and snippets.

@informationsea
Created November 5, 2013 03:08
Show Gist options
  • Save informationsea/7313221 to your computer and use it in GitHub Desktop.
Save informationsea/7313221 to your computer and use it in GitHub Desktop.
Growl script for Maverick's Message
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", "File Transfer Completed"}
-- 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", "File Transfer Completed"}
-- Register our script with growl.
-- You can optionally (as here) set a default icon
-- for this script's notifications.
register as application ¬
"Messages" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "Messages"
try
notify with name theNotify title theTitle description theMessage application name "Messages" image theImage
on error msg
notify with name theNotify title theTitle description theMessage application name "Messages" image from location "/Applications/Messages.app/Contents/Resources/Prefs_MsgCompose.tiff"
end try
end tell
end showgrowl
using terms from application "Messages"
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 chat room message received theText from theBuddy for theChat with text
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 chat room message received
on addressed message received theText from theBuddy for theChat with text
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 addressed message received
on addressed chat room message received theText from theBuddy for theChat with text
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 addressed chat room message received
on active chat message received from theBuddy for theChat with text
-- do nothing
end active chat 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
on completed file transfer fileTransfer with text
set theBuddy to buddy of fileTransfer
set hisname to name of theBuddy
set hisimage to image of theBuddy
showgrowl("File Transfer Completed", hisimage, "File Transfer Completed", "File Transfer Invitation from " & hisname)
end completed file transfer
on message sent for textChat with text
-- do nothing
end message sent
on login finished for theService with text
-- do nothing
end login finished
on logout finished for service with text
-- do nothing
end logout finished
on av chat started theAudioChat with text
-- do nothing
end av chat started
on av chat ended theAudioChat with text
-- do nothing
end av chat ended
end using terms from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment