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):
repeat 1000000 times
tell application "System Events" to keystroke return
delay 1
end repeat
And that's it. I saved the script so that if I ever get in a similar situation, I can just edit the script to hit the key I want.
[
crarko adds: I have not run into this issue, but if you do get it, having some idea for relief is probably quite welcome, even if it's not the most elegant. If there are alternative superior methods, please suggest them in the comments.]