Hello Bill and Deivy, Thank you for your replies. On Jul 29, 2009, at 12:35 AM, Bill Steele wrote: > Don';t know the syntax in Mail, but what I use in Eudora is > > set theLast to (count of messages of mailbox "In") > > Then loop from msg1 to theLast. > This seems to work fine in Mail too. But... I tried: tell application "Mail" set theLast to (count of messages of mailbox "INBOX" of account "myaccount") end tell and I got a number. But when I do: tell application "Mail" set theLast to (count of messages of mailbox "INBOX" of account "myaccount") get the content of (message theLast of mailbox "INBOX" of account "myaccount") end tell I get a text which has no relation with the last message of my 'mailbox "INBOX" of account "myaccount"'... This seems to mean that the reference by number to a specific message does not work...?? ------- On Jul 29, 2009, at 12:37 AM, Deivy Petrescu wrote: > I use this script for myself. > It is a bit rough but does it job. > > -- paramenters > set mb to "INBOX" > set acct to "myaccount" > set First_Msg to 250 > set Last_Msg to 200 > > --script that in this case erase repeated messages in the range > 200 to 250 from the mailbox mb of account acct > > with timeout of 3900 seconds > tell application "Mail" > tell mailbox mb of account acct to repeat with msg from > First_Msg to Last_Msg by -1 > if (message id of message msg) = (message id of message (msg - > 1)) then delete (message msg ) > end repeat > end tell > end timeout This seems very good, but because of the problem of the reference by number, that I mentioned above, I cannot use this method...?? Any other ideas? Thank you very much in advance!! Best regard, Nobumi Iyanaga Tokyo, Japan