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


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.
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 | # ]