Mail Applescript "set new mail sound" -> Apple Event handler failed
The following Applescript segment works in Snow Leopard and fails in Lion with "AppleEvent handler failed. number -10000"
tell application "Mail"
set new mail sound to "Glass"
end tell
In addition, the Apple-supplied, Mail Applescript for gathering Mail information "Display All Accounts and Preferences.scpt" fails
(again with "AppleEvent handler failed. number -10000") on the line
set displayString to displayString & my formatFields("New mail sound", new mail sound) & return
The Console Log reports the following error.
Mail: [<MailApp 0x7fd6a9e009a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key newMailSound.
The Mail Applescript property "new mail sound" appears not to be recognized correctly.
I do not have any Mail plugins. Several additional sounds have been added to the system sound set. Mail reports no problems using them.
Under Snow Leopard, I used the same Applescripts (fired off by iCal) which turned on/off Mail's New Mail Sound depending on the time of day, i.e. I set the new mail sound to be "Silent Alert" in the evening and restored it to my default new mail alert in the morning. Any guidance as to what might be wrong and how to solve this problem would be very welcome.
iMac, Mac OS X (10.7.3)