MACSCRPT Archives

July 2009

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Deivy Petrescu <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Tue, 28 Jul 2009 21:20:10 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (92 lines)
On Jul 28, 2009, at 8:28 PM, Nobumi Iyanaga wrote:

> 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



Nobumi,

Last and first are properties which are set by the time the message is  
received.
Check, in your example above if  the last message is not the one that  
was the last by sorting via date received.

And another point, you can use my script with no fear it only deletes  
messages if the ids are the same.


Deivy Petrescu
[log in to unmask]

ATOM RSS1 RSS2