Dismiss repeated alert windows in the Calendar

I recently imported an .ics file into the Reminders app, but it turned out all the events were already in there, and the Calendar app balked at them, one at a time, repeatedly. I was continuously presented with an alert window which said that the event already exists and I could either cancel, go offline, or revert to server (the default). After hitting return a few dozen times, I decided I would write a quick AppleScript, and do something else while it worked. I’m sure a number of Hints followers might balk at this strategy, but it worked for and I didn’t care how crude it was.

I just wanted to select the default button (revert to server) in every alert window, so all I needed was a script that would hit the return key every second. I wrote this in script editor, brought one of the alert windows to the front, then Command+clicked the “Run” button in the Script Editor (so it wouldn’t bring the script window to the front):

Source: Mac OSX Hints