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 00:07:22 +0900
Content-Type:
text/plain
Parts/Attachments:
text/plain (67 lines)
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

ATOM RSS1 RSS2