Skip to content

Instantly share code, notes, and snippets.

@daveferrara1
Forked from tresni/Growl.applescript
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daveferrara1/9fd6a0bc68410aa9ad9c to your computer and use it in GitHub Desktop.
Save daveferrara1/9fd6a0bc68410aa9ad9c to your computer and use it in GitHub Desktop.
on run
tell application "Growl"
-- Make a list of all the notification types that this script will ever send:
set the allNotificationsList to {"IM Received", "Account Connected", "Account Disconnected", "Buddy Available", "Buddy Unavailable"}
-- Make a list of the notifications that will be enabled by default.
set the enabledNotificationsList to {"IM Received"}
-- Register our script with growl.
register as application "iChat Growl AppleScript" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "iChat"
end tell
end run
on GrowlMessage(_type, _title, message, icon)
tell application "Growl"
if icon is equal to missing value then
notify with name _type title _title description message application name "iChat Growl AppleScript" without sticky
else
notify with name _type title _title description message application name "iChat Growl AppleScript" image icon without sticky
end if
end tell
end GrowlMessage
using terms from application "iChat"
on login finished for theService
my GrowlMessage("Account Connected", name of theService, "Connected", missing value)
end login finished
on logout finished for theService
my GrowlMessage("Account Disconnected", name of theService, "Disconnected", missing value)
end logout finished
on buddy became available theBuddy
my GrowlMessage("Buddy Available", full name of theBuddy, full name of theBuddy & "is available", image of theBuddy)
end buddy became available
on buddy became unavailable theBuddy
my GrowlMessage("Buddy Unavailable", full name of theBuddy, full name of theBuddy & "is unavailable", image of theBuddy)
end buddy became unavailable
on message sent message for textChat
end message sent
on message received message from theBuddy for textChat
set whoDidIt to full name of theBuddy
set who to "iChat: " & whoDidIt
set buddyIcon to image of theBuddy
tell application "System Events"
set frontApp to name of first application process whose frontmost is true
end tell
tell application frontApp
set window_name to name of front window
end tell
if whoDidIt is not in window_name then
my GrowlMessage("IM Received", who, message, buddyIcon)
end if
end message received
end using terms from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment