AppleScript System Events Bug
Despite the number of people successfully using my iPhoto AppleScripts, I’ve had a troubling number of people report problems as well. These weren’t just little problems, the scripts completely failed to run.
I asked several of these people to run the scripts from Script Editor and send me the error message they got when the scripts failed. All but one of the problems happened during a call to the System Events background application. Most infuriating was the fact that I couldn’t reproduce the problem. Today I managed to recreate what I believe is the problem.
The script below is a test script which pounds on System Events then tries to detect and recover from System Events crashes.
UIcheck() System Events Test Script (UIcheck.zip, 4k)
Please download the script and post your results in the comments. I’m seeing a consistent 3-9% failure rate for System Events on my PowerBook.
This is public domain, use at your own risk, etc. Please post improvements if you have them.
Update: Please post your OS version alongside any results.
Update 2: More on the System Events AppleScript bugginess Including a new test script.

