Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Select duplicate messages in Mail Apps
Tiger only hintThis AppleScript will select all the duplicate messages in the currently open Message Viewer window in Mail.app.

To use this script:
  1. Open up Script Editor and paste the code into a new window.
  2. Save it somewhere convenient, like the Desktop or if you have your Scripts menubar item activated, under ~/Library/Scripts.
  3. Open up Mail 2.0 and select the mailboxes to scan so the message list displays all the messages you want to scan.
  4. Run the script. When the script is finished, a notification dialog will popup.
  5. Move the selected duplicate messages to the Trash or do anything else with them.
The script works by scanning each message and recording it's message ID in a list. If the list already contains that message ID, then it selects the message.
    •    
  • Currently 3.56 / 5
  You rated: 4 / 5 (9 votes cast)
 
[31,211 views]  

10.4: Select duplicate messages in Mail | 6 comments | Create New Account
Click here to return to the '10.4: Select duplicate messages in Mail' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Select duplicate messages in Mail
Authored by: ideamani on May 11, '05 11:49:36AM

Andreas Amaan also has a load of Mail related scripts at http://homepage.mac.com/aamann/Mail_Scripts.html. The duplicates removal works quite well even on HUGE mailboxes.



[ Reply to This | # ]
10.4: Select duplicate messages in Mail
Authored by: iGav on May 12, '05 12:09:52PM

I've tried the remove duplicates script to try and trim down my mailboxes which have gotten bloated as a result of a bad migration to Tiger.

Doesn't work, I'm afraid - did absolutely diddly for me



[ Reply to This | # ]
10.4: Select duplicate messages in Mail
Authored by: aamann on May 29, '05 07:01:40PM

Well, this is because you used the scripts which hadn't been updated for Tiger yet - as of version 2.7 (which had been out a few days after you had the old version not do anything for you), the scripts have been updated to know about the new mailbox structure on disk introduced by 10.4.

You might want to give it another try with the current version.



[ Reply to This | # ]
10.4: Select duplicate messages in Mail
Authored by: GaelicWizard on Dec 03, '05 07:45:55PM

This script worked once for me, but not since! I just figured out why: This script will not look within a threaded message group. Before running this script, select View-> Expand All Threads. Then, it will work!

JP

---
Pell



[ Reply to This | # ]
10.4: Select duplicate messages in Mail
Authored by: GaelicWizard on Dec 03, '05 07:51:36PM
Here's another problem you might run into: Some e-mails, from misbehaving servers, might not have message id's!!! This script doesn't check for a blank message id, and will list all (minus one) as duplicates!

The trick is to replace the following:

		if mids contains i then

With:

		if (length of i) = 0 then
			--display dialog "This message does not have a Message-id." buttons {"OK"} default button 1 with title (subject of eachMessage as string)
		else if mids contains i then


Then, it will ignore messages with blank ids. Unfortunately, you might have duplicates with blank ids, and this will not detect them.

JP

---
Pell

[ Reply to This | # ]

10.4: Select duplicate messages in Mail
Authored by: anthony11 on Jun 30, '10 10:08:41AM

I've had this running for about 20 hours now, on a 1.6GHz G5 in a local folder with 9556 messages, about half of them dups. I project it'll finish around the 24 hour mark. My knowledge of Applescript is pretty much nil, but I have to wonder if there's a way to programmatically add to the selection, rather than adding to the (associative?) array eachMessage then selecting the whole thing over again.



[ Reply to This | # ]