Applescript Snippet - Growl as error handler notifier

The Growl forums have moved to Google Groups, this forum is read only.
User avatar
Posts: 18
Joined: Sat Dec 04, 2004 10:51 pm
Location: Southern Tasmania

Applescript Snippet - Growl as error handler notifier

Post by Hypercube »

Was fiddling a week or so back, thought this might be of use to people...

Code: Select all

set myHandlerDetails4ErrorStr to "testGrowlErrorHandler"
set myAppName to name of me
	set myThing to 100 / 0
on error m number n
		tell application "System Events"
			set myGrowl to "GrowlHelperApp" as string
			set GrowlExists to exists application process myGrowl
		end tell
		if GrowlExists then
			using terms from application "GrowlHelperApp"
				tell application "GrowlHelperApp"
					notify with title ("Error #" & n) as string description ({"\"", m, "\"", return, "In: ", myHandlerDetails4ErrorStr} as string) icon of application myAppName
				end tell
			end using terms from
			-- display dialog, or other notification method
			-- such as AppleScript's 'log' command if in a script editor
		end if
	on error m number n
		display dialog ({"error when trying to advise of error using growl; \"", m,"\"", return, n as string} as string)
	end try
end try
Have Fun
Hug the ones you love, now.
[Avatar by Ipi37]