An Error in Mail
An Error in Mail
- Subject: An Error in Mail
- From: Luther Fuller <email@hidden>
- Date: Tue, 27 Sep 2011 10:56:40 -0500
I was trying to get some info from Mail with this script ...
tell application "Mail" activate set frontViewer to (some message viewer whose index is 1) set msgList to (selected messages of frontViewer) set msgCount to (count items of msgList) if msgCount = 0 then return end tell
but, I kept getting an error telling me that msgList was undefined. There were no selected messages, so msgList should be defined as {}. I finally tried this ...
tell application "Mail" activate set frontViewer to (some message viewer whose index is 1) set msgList to (selected messages of frontViewer) try set msgCount to (count items of msgList) on error return end try end tell
and it worked correctly. It seems that Mail does NOT return an empty list if there is no selection. Instead, selected messages of frontViewer incorrectly returns NOTHING if there are no selected messages.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden