Disable Growl pop-up notifications via AppleScript

Dec 04, '08 07:30:01AM

Contributed by: Anonymous

This happens to my friends and I all the time ... you're giving a presentation, watching a movie, or whatever, and the Growl notifier starts popping up with your gChat messages or messages from GMail. I finally wrote an AppleScript to easily toggle the two notifiers for such circumstances; I hope this is helpful for others! Here's the script:

tell application "System Events"
    set isRunning_Growl to (count of (every process whose name is "GrowlHelperApp")) > 0
    set isRunning_Google to (count of (every process whose name is "Google Notifier")) > 0
end tell

if isRunning_Google then
    tell application "GrowlHelperApp"
        set the allNotificationsList to {"Growl Toggler"}
        register as application "Growl Toggler" all notifications allNotificationsList default notifications allNotificationsList
        notify with name "Growl Toggler" title "Notifications OFF" description "" application name "Growl Toggler" icon of application "Automator"
    end tell
    delay (2)
    tell application "Google Notifier" to quit
    tell application "GrowlHelperApp" to quit
else
    tell application "Google Notifier" to launch
    tell application "GrowlHelperApp" to launch
    tell application "GrowlHelperApp"
        set the allNotificationsList to {"Growl Toggler"}
        register as application "Growl Toggler" all notifications allNotificationsList default notifications allNotificationsList
        notify with name "Growl Toggler" title "Notifications ON" description "" application name "Growl Toggler" icon of application "Automator"
    end tell
end if

[robg adds: To use this, save it as an application, then double-click it when needed. I haven't tested this one.]

Comments (6)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20081128100549105