• 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
Move message to another mailbox behaves erratically?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Move message to another mailbox behaves erratically?


  • Subject: Move message to another mailbox behaves erratically?
  • From: Michael Heinz <email@hidden>
  • Date: Fri, 7 Mar 2003 00:38:02 -0500

So, I figured out to set the mailbox property of each message to move them between mailboxes. Okay; fine. But things still don't work as expected. Here's a code fragment:

tell application "Mail"
set my_archive to mailbox ArchiveBox

ignoring case
repeat with cur_rule in CategoryList
set my_messages to (every message of mailbox ArchiveBox whose sender contains (item 1 of cur_rule))
set new_mailbox to mailbox (item 2 of cur_rule)
repeat with my_message in my_messages
display dialog (item 1 of cur_rule) & ": " & sender of my_message as string
set mailbox of my_message to mailbox (item 2 of cur_rule)
end repeat
end repeat
end ignoring
end tell

The display dialog is there for diagnostic purposes. If I comment out the "set mailbox" line, the script performs as expected. But when I try to actually do the move, things quickly go sour. As near as I can tell, once a message has been moved, the my_messages list becomes corrupt - it starts pointing at the wrong messages! You can see this in the display dialog, where you be told that the string "Todd" contains the string "Penny", for example.

Can anyone tell me what I'm doing wrong? I'd like to write a script that archives and sorts old mail into different bins, and I'm soooo close.

Thanks.
_______________________________________________
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: Move message to another mailbox behaves erratically?
      • From: cricket <email@hidden>
  • Prev by Date: Re: path to selection
  • Next by Date: Selecting messages in Outlook Express
  • Previous by thread: Re: Script Editor.crash.log
  • Next by thread: Re: Move message to another mailbox behaves erratically?
  • Index(es):
    • Date
    • Thread