• 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
Scripting Mail
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scripting Mail


  • Subject: Scripting Mail
  • From: Lewis Butler <email@hidden>
  • Date: Sun, 25 May 2003 17:13:14 -0600

I was trying to setup a script that would "touch" every mailbox, forcing it to refresh the current status from the imap server:

tell application "Mail"
set AllMailboxes to (every mailbox of every account)
repeat with x in AllMailboxes
tell message viewer 1
set selected mailboxes to {x}
end tell
end repeat
end tell

This fails when the second set statement tries to set the selection to all the mailboxes of the first account at once. AllMailboxes contains a list of lists:

{{mailbox "one" of account "one", mailbox "two" of account "two"},{mailbox "one" of account "two"}}


tell application "Mail"
set AllMailboxes to (every mailbox of account "applescript")
repeat with x in AllMailboxes
tell message viewer 11
set selected mailboxes to {x}
end tell
end repeat
end tell

works fine. So how do I write the script so that it will work for a setup where there is one account or many? Do I have to get the list of accounts and then step through that getting the list of all the mailboxes? Or is there a way to do it all in one swell foob?


The only thing I can think to do, but it feels kludgy (though it does work) is:

tell application "Mail"
set AllMailboxes to (every mailbox of every account)
repeat with x in AllMailboxes
repeat with y in x
tell message viewer 1
set selected mailboxes to {y}
end tell
end repeat
end repeat
end tell

But that presupposes there is more than one account.


--
In England 100 miles is a long distance. In the US 100 years is a long time
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: Scripting Mail
      • From: Michelle Steiner <email@hidden>
  • Prev by Date: itunes 4 and artwork and shared lists
  • Next by Date: Re: Scripting Mail
  • Previous by thread: Scripting Mail
  • Next by thread: Re: Scripting Mail
  • Index(es):
    • Date
    • Thread