• 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
Re: Mail Search surrogate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mail Search surrogate


  • Subject: Re: Mail Search surrogate
  • From: Gil Dawson <email@hidden>
  • Date: Thu, 9 Apr 2009 16:44:05 -0700

On Apr 9, 2009, at 11:01 A, Luther Fuller wrote:
set allMailboxes to mailboxes as list

"As List!" That got me started.  Why do some lists of things require "as list" and some don't?

After a bit of tinkering I think I found a way to get an exhaustive list of all my mailboxen:

set AllMyBoxes to {}
tell application "Mail"
set myAccts to every account
repeat with anAcct in myAccts
set AllBoxes to every mailbox of anAcct
repeat with aBox in AllBoxes
set the end of AllMyBoxes to the contents of aBox
end repeat
end repeat
set MainBoxes to (mailboxes as list)
repeat with aBox in MainBoxes
set the end of AllMyBoxes to the contents of aBox
end repeat
end tell
AllMyBoxes 

The last line lists what seems to be all my mailboxes, even -- amazingly! -- those that are inside other mailboxes, e.g.:

 mailbox "Receipts/PayPal" of application "Mail"
 mailbox "Receipts/Quicken" of application "Mail"
 mailbox "Receipts/Received Stuff" of application "Mail"
 mailbox "Receipts" of application "Mail"

This is a different result from Michelle's suggestion (above) that overlooked messages in subfolders.

Evidently, some mailboxes belong to an account, e.g.:

 mailbox "INBOX" of account "Dominant" of application "Mail"
 mailbox "Drafts" of account "Dominant" of application "Mail"
 mailbox "Sent Messages" of account "Dominant" of application "Mail"
 mailbox "Deleted Messages" of account "Dominant" of application "Mail"
 mailbox "INBOX" of account "Enkidu" of application "Mail"
 mailbox "Drafts" of account "Enkidu" of application "Mail"
 mailbox "Deleted Messages" of account "Enkidu" of application "Mail"

These are not included in "mailboxes".  I.e., "set MainBoxes to (mailboxes as list)" does not retrieve any of these.  That's why the code above has to fetch these separately.

Some mailboxes are missing (e.g., "Sent Messages" of account "Enkidu"), I hope because they are empty.

I think from this point I'll be able to code up something to visit every message with great confidence.

Thanks for y'all's help!

--Gil

Confidential to Yvan: "Y'all's" is Southern slang, the plural possessive form for "you."   If I said, "Thanks for your help!", it would be ambiguous whether I meant one person or several.  Southern solves that problem with "you-all" and its declensions and contractions.  You-plural-possessive is probably simpler in French, but we-uns has to work with what we got.

 _______________________________________________
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: Mail Search surrogate
      • From: Luther Fuller <email@hidden>
References: 
 >Re: Unicode Character in File Name (From: CYB <email@hidden>)
 >Re: Unicode Character in File Name (From: Luther Fuller <email@hidden>)
 >Re: Unicode Character in File Name (From: "Mark J. Reed" <email@hidden>)
 >Re: Unicode Character in File Name (From: Luther Fuller <email@hidden>)
 >Re: Unicode Character in File Name (From: Christopher Nebel <email@hidden>)
 >Re: Unicode Character in File Name (From: Luther Fuller <email@hidden>)
 >Re: Unicode Character in File Name (From: Christopher Nebel <email@hidden>)
 >Re: Unicode Character in File Name (From: "Mark J. Reed" <email@hidden>)
 >Re: Unicode Character in File Name (From: Doug McNutt <email@hidden>)
 >Mail Search surrogate (From: Gil Dawson <email@hidden>)
 >Re: Mail Search surrogate (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: Mail Search surrogate
  • Next by Date: Re: Mail Search surrogate
  • Previous by thread: Re: Mail Search surrogate
  • Next by thread: Re: Mail Search surrogate
  • Index(es):
    • Date
    • Thread