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 11:37:23 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (103 lines)
On Jul 28, 2009, at 11:07 AM, Nobumi Iyanaga wrote:

> Hello John,
>
> On Jul 28, 2009, at 11:57 AM, John Baltutis wrote:
>
>> On 7/27/09,  Nobumi Iyanaga <[log in to unmask]> wrote:
>>>
>>> ...
>>> As I have many messages (more than a thousand) in my Inbox, I would
>>> not need to do this process for the entire Inbox (and that would  
>>> take
>>> a very long time). What I would really need is to know how to get  
>>> the
>>> "selected message" in the Inbox. Conceptually, I think the script
>>> would be something like this:
>>>
>>> tell application "Mail"
>>> 	tell Inbox
>>> 		set the_start to selected message
>>> 		set last_one to the_start
>>> 		set the_start to next message of the_start
>>> 		repeat with i from the_start to last message
>>> 			if contents of last_one is same as contents of i
>>> 				delete last_one
>>> 			end if
>>> 			set last_one to i
>>> 		end repeat
>>> 	end tell
>>> end tell
>>>
>>> Of course, I have not tested this "concept script", but it would  
>>> help
>>> you to understand what I would like to achieve.
>>>
>>> Could any of you indicate me how to write this script?
>>>
>>> Thank you very much in advance!
>>
>> Check the Archives at
>> <http://lists.apple.com/mailman/listinfo/applescript-users>
>
> Thank you for this info. I could find a message in archive in which  
> a script:
>
> tell application "Mail"	
> 	set theSel to selection
> 	set msg1 to item 1 of theSel
> end tell
>
> works for getting the id, the mail box and the account of the  
> selected message. I can also get the "content" of the message.
>
> But how can I do a loop from the currently selected message until  
> the last message? I tried to do:
>
> tell application "Mail"
> 	set the_last to last message of account "my_account" of mailbox  
> "INBOX"
> end tell
>
> but this returns the error message: "Mail got an error: Can't make  
> last message of account "my_account" of mailbox "INBOX" into type  
> reference."
>
> Thank you very much in advance.
>
> Best regard,
>
> Nobumi Iyanaga
> Tokyo,
> Japan


Nobumi,

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



Deivy Petrescu
[log in to unmask]

ATOM RSS1 RSS2