Code: Select all
set myHandlerDetails4ErrorStr to "testGrowlErrorHandler"
set myAppName to name of me
try
set myThing to 100 / 0
on error m number n
try
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
else
-- 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
Martin