• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problems with lists in Mail
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with lists in Mail


  • Subject: Problems with lists in Mail
  • From: Luther Fuller <email@hidden>
  • Date: Mon, 08 Aug 2011 16:48:05 -0500

This problem occurs in both Snow Leopard and Lion.
Here's the script ...

tell application "Mail"
set frontViewer to (some message viewer whose index is 1)
set msgList to selected messages of frontViewer
count selected messages of frontViewer --> this returns 0 if selection is empty without error
count items of msgList -- this errors if the selection is empty
class of msgList --> pcls, if empty list; list, if list is not empty
end tell


Shouldn't 
msgList
 be a 'list' even if it's an empty? What is 'pcls'?

I've tried changing the second line to ...

set msgList to (selected messages of frontViewer) as list

But, there is still a problem if there is no selection:

count items of msgList

incorrectly returns 1, but

class of msgList

now correctly returns 'list'.

The work-around for this problem is simply to use 
count selected messages of frontViewer
.
But why shouldn't I get a list, always, which has count = 0, if appropriate?

 _______________________________________________
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

  • Follow-Ups:
    • Re: Problems with lists in Mail
      • From: Shane Stanley <email@hidden>
    • Re: Problems with lists in Mail
      • From: Christopher Stone <email@hidden>
  • Prev by Date: Re: Plain Text Editor
  • Next by Date: Re: Problems with lists in Mail
  • Previous by thread: Re: Deprecated ?
  • Next by thread: Re: Problems with lists in Mail
  • Index(es):
    • Date
    • Thread