10.8: AppleScript to close iCal Alerts

I’d just installed OS X 10.8, and booted to find the right side of my screen covered in Birthday and Calendar notifications! Since installing I’ve clicked ‘Close’ on way too many iCal notification alerts.

Here’s a script to close them all for you in one fell swoop. Since I still want iCal to popup a Notification alert for event alarms I’ve set, I don’t want to simply disable all the iCal notifications (or set them to temporary banner alerts).

However, it still occurs that sometimes a small pile of alerts have accrued while I was away from the computer, and I really hate hitting ‘Close’ a bunch of times.

So, followng is a script to simply close all the piled-up Notification Alerts. The script was put together using these two webpages for inspiration: http://macosxautomation.com/mavericks/notifications/01A.html (most of the nice code comes from here) and …

Source: Mac OSX Hints