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:
Nobumi Iyanaga <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Wed, 29 Jul 2009 11:32:48 +0900
Content-Type:
text/plain
Parts/Attachments:
text/plain (104 lines)
Hello Deivy,

On Jul 29, 2009, at 10:20 AM, Deivy Petrescu wrote:

> On Jul 28, 2009, at 8:28 PM, Nobumi Iyanaga wrote:
>
>> 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.

In my example above, I used the number of messages in the INBOX  
("count of messages of mailbox "INBOX" of account "myaccount""); I  
tried with the "last" property:

tell application "Mail"
	get content of (last message of mailbox "INBOX" of account  
"Nifty_mail")
end tell

I got the same result as the previous example. It is NOT the "last"  
by date received...??

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

This is very good to know. Thank you!

But I need to limit the range of messages to be processed from "the  
currently selected" message, to the last message, sorted by date  
received...

Best regard,

Nobumi Iyanaga
Tokyo,
Japan

ATOM RSS1 RSS2