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:
Tue, 28 Jul 2009 08:26:32 +0900
Content-Type:
text/plain
Parts/Attachments:
text/plain (53 lines)
Hello,

I would like to write an AppleScript script which will delete  
duplicated messages from my Mail.app Inbox, from a certain point  
until the last one.

Here is my situation:
I have two computers that I use daily, one at home and another at  
work. One runs OS 10.4.11 and the other OS 10.5.7 (?). I want to  
synchronize the contents of Mails in these two computers -- not only  
for the InBox, but for all the mail boxes.

Before, I used to use two computers of the same OS version (10.4.11),  
and I could achieve my goal doing a backup and restore of the  
contents of ~/Library/Mail/ via a portable harddisk. Now, with two  
computers of different OS, this does not work perfectly: when I open  
Mail.app, the contents are the same, but when I download new mails,  
Mail.app downloads the messages which are already there, so I have to  
delete duplicated messages from the InBox.

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!

Best regard,

Nobumi Iyanaga
Tokyo,
Japan

ATOM RSS1 RSS2