For a while I have been using an applescript to announce new mail, but Mail now crashes if you are doing anything when it announces the arrival of mail. This is not my script, but one that comes in the applescript examples. Can anyone see why it would cause a crash?
using terms from application "Mail" on perform mail action with messages selectedMsgs -- See Mail's AppleScript dictionary for the full documentation on the -- 'perform mail action with messages' handler. set logString to "" & return tell application "Mail" set selCount to (count of selectedMsgs) if selCount is equal to 0 then set logString to logString & "There are no selected messages." else if selCount is equal to 1 then set logString to logString & "There is " & selCount & " selected message." else if selCount > 1 then set logString to logString & "There are " & selCount & " selected messages." end if repeat with counter from 1 to selCount set msg to item counter of selectedMsgs set theSubject to subject of msg set theSender to sender of msg set theSender to extract name from theSender set logString to (logString & tab & "Message " & counter as string) & " from: " & theSender & ", subject: " & theSubject & ". " end repeat end tell if length of logString > 0 then say logString end if end perform mail action with messages end using terms from
-- If run as an ordinary script, instead of directly from the Scripts -- menu, it will call the default handler instead. using terms from application "Mail" on run tell application "Mail" to set sel to selection tell me to perform mail action with messages (sel) end run end using terms from
|