Re: Move message to another mailbox behaves erratically?
Re: Move message to another mailbox behaves erratically?
- Subject: Re: Move message to another mailbox behaves erratically?
- From: cricket <email@hidden>
- Date: Fri, 7 Mar 2003 13:04:46 -0800
It's hard to say for sure without seeing the construction of the
CategoryList structure. My guess would be that my_messages is matching
all messages or a bigger subset than you are expecting, which is
leading to results that look like corruption in the my_messages
variable.
Try to figure out if my_messages truly contains the messages you expect
it to contain.
- cricket
On Thursday, March 6, 2003, at 9:38 PM, Michael Heinz wrote:
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.
----->
Software Entomologist Mail for Mac OS X
http://www.apple.com/macosx/jaguar/mail.html
---------->
The only person I can stand to be around is a neutered vampire who
cheats at kitten poker.
_______________________________________________
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.