Skip to content

Instantly share code, notes, and snippets.

@seancoyne
Created October 6, 2011 02:34
Show Gist options
  • Select an option

  • Save seancoyne/1266357 to your computer and use it in GitHub Desktop.

Select an option

Save seancoyne/1266357 to your computer and use it in GitHub Desktop.
Applescript for iChat Growl (1.3) Notifications
on notify_growl(theName, theTitle, theDescription, theImage)
tell application "Growl"
if (theImage is not null) then
notify with name theName title theTitle description theDescription application name "iChat" image theImage
else
notify with name theName title theTitle description theDescription application name "iChat"
end if
end tell
end notify_growl
using terms from application "iChat"
-- register the app with growl
tell application "Growl"
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 "Messages"
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
try
notify_growl("Message Received", "Message Received from " & name of theBuddy, theMessage, image of theBuddy)
on error
notify_growl("Message Received", "Message Received from " & name of theBuddy, theMessage, null)
end try
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
try
notify_growl("Message Received", "Message Received from " & name of theBuddy, theMessage, image of theBuddy)
on error
notify_growl("Message Received", "Message Received from " & name of theBuddy, theMessage, null)
end try
end if
end received text invitation
end using terms from
@seancoyne
Copy link
Copy Markdown
Author

updated to support Messages beta and to handle missing buddy images

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment