Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Disable Growl pop-up notifications via AppleScript Apps
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.]
    •    
  • Currently 3.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[16,680 views]  

Disable Growl pop-up notifications via AppleScript | 6 comments | Create New Account
Click here to return to the 'Disable Growl pop-up notifications via AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Question
Authored by: lincd0 on Dec 04, '08 07:55:22AM

How is this better than opening the Growl preference pane and clicking the 'Stop Growl' button?



[ Reply to This | # ]
Disable Growl pop-up notifications via AppleScript
Authored by: ravencub on Dec 04, '08 08:16:52AM

Or even better: Click the Growl icon on the menu bar and select "Stop Growl".



[ Reply to This | # ]
Disable Growl pop-up notifications via AppleScript
Authored by: imcquill on Dec 04, '08 09:39:13AM

If the author wrote it, it probably has some use to them.

I will give one example of how this could be used for someone I know. This person works regular hours and there are always people hovering around.. one might not want to have their private mail messages displayed on screen when people are around. Or have their twitter messages come up on screen when people could be watching their screen. So that person may want to disable growl during the day when they are at work, but use it the rest of the time.

So take the applescript, save it as an app, and make a launchd entry so that growl gets disables at some sensible time before work, and gets enabled at some sensible time after work all automatically. Or have the applescript be triggered by an ical event, say 15 minutes before a presentation. Otherwise, they may forget to actual turn off growl in the menubar each time. Applescript has some advantages over doing something manually.



[ Reply to This | # ]
Disable Growl pop-up notifications via AppleScript
Authored by: ShadowBottle on Dec 05, '08 08:48:06AM

Personally I already have enough stuff in my menubar and launching growl prefs would still require some mousing. This appescript can be run from quicksilver with just a few keystrokes and no mousing and be immediate. I dig.



[ Reply to This | # ]
Disable Growl pop-up notifications via AppleScript
Authored by: styrafome on Dec 07, '08 12:32:41AM

This is cool. I'd be more interested in some kind of app or script that suppresses Growl notifications only when a specific app is in the foreground, such as PowerPoint or Keynote. Just so it would be automatic. Even better, but probably tougher, is if it could suppress when the foreground app is in full screen mode.

As far as it taking a long time to mouse into Growl prefs, it does not have to. Just type "Growl" into Spotlight and click the prefs icon in the Spotlight list. The Growl master switch and the "Hide All Notifications" checkbox then appear right away.



[ Reply to This | # ]
Disable Growl pop-up notifications via AppleScript
Authored by: kaz219 on Dec 20, '10 03:18:00AM
I’m trying to get this to work, unfortunately I get a "connection invalid" error…

tell application "System Events"
	count every process whose name = "GrowlHelperApp"
		--> 0
end tell
tell application "AppleScript Editor"
	«event register» given «class appl»:"Growl Toggler", «class anot»:{"Growl Toggler"}, «class dnot»:{"Growl Toggler"}
Result:
error "GrowlHelperApp got an error: Connection is invalid." number -609
I modified the script since I just want to turn Growl on/off, I don’t have any google notifier:

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_Growl 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 "GoogleTalkPlugin" to quit
	tell application "GrowlHelperApp" to quit
else
	--	tell application "GoogleTalkPlugin" 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
These “register as” lines, are they really necessary? I mean, after the first run, the application “Growl Toggle” is registered, and it shouldn’t be necessary for all other runs of the script, should it?

[ Reply to This | # ]