Skip to content

Instantly share code, notes, and snippets.

@quackingduck
Created April 26, 2010 20:32
Show Gist options
  • Save quackingduck/379866 to your computer and use it in GitHub Desktop.
Save quackingduck/379866 to your computer and use it in GitHub Desktop.
# See: http://growl.info/documentation/applescript-support.php
# This is still pretty much voodoo to me
#
# The name argument specifies the name that will appear in the "Applications"
# tab of the Growl preferences pane.
def RBGrowl(name, title, body, icon = 'Console')
name, title, body, icon = [name, title, body, icon].map { |v| v.inspect }
ascript = %{tell application "GrowlHelperApp"
-- Make a list of all the notification types that this script will ever send:
set the allNotificationsList to {#{name}}
-- Make a list of the notifications that will be enabled by default.
set the enabledNotificationsList to {#{name}}
-- Register our script with growl.
register as application #{name} ¬
all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application #{icon}
-- Send a Notification...
notify with name #{name} ¬
title #{title} ¬
description #{body} ¬
application name #{name}
end tell}
system 'osascript', '-e', ascript
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment