On 7/3/05 5:48 am, "Jan Martel" <[EMAIL PROTECTED]> wrote:

> On 3/6/05 9:30 PM, "Allen Watson"  wrote:
> 
>> first, my latest and fastest script for finding duplicate messages is
>> "Categorize Duplicate Messages", on scriptbuilders at macscripter.net.
> 
> I couldn't find it there - I found categorize duplicate contacts, but not
> messages.

In that case, try this script. It will delete duplicate messages based on
the unique message ID field, and is more reliable (if a little slower) that
other methods of detecting duplicates:

Copy/paste the script below into script editor and run it from there:

-- Remove Duplicate Message v1.0
-- An Applescript by Barry Wainwright, 18th March 2002
-- Detects and deletes duplicate messages within a selected folder
-- works on Message-ID header - uniquely identifying duplicates

tell application "Microsoft Entourage"
    set theMessages to current messages
    if theMessages = {} then
        set theFolder to selection
        if class of theFolder is folder then
            set mb to theFolder
        else
            display dialog "In the folder listing, please select the folder
you want to be scanned for duplicates" with icon stop buttons {"Quit"}
default button 1
            return -99
        end if
    else
        set mb to storage of item 1 of theMessages
    end if
    set theName to name of mb
    say "Removing duplicates from mail folder: " & theName
    set y to count messages of mb
    say "Number of messages to check, " & y
    set IDlist to {}
    repeat with x from y to 1 by -1
        try
            set theHeaders to (get headers of message x of mb)
            set AppleScript's text item delimiters to {"Message-"}
            set temp to text item 2 of theHeaders
            set AppleScript's text item delimiters to {return}
            set theId to text 5 through -1 of text item 1 of temp
        on error
            set theId to ""
        end try
        if theId is in my IDlist then
            delete message x of mb
        else if theId � "" then
            copy theId to end of IDlist
        end if
        if x mod 100 = 0 then say "" & x
    end repeat
    set removedCount to y - (count messages of mb)
    if removedCount is 0 then
        say "Finished. No duplicates detected"
    else
        say "Finished. " & removedCount & " duplicates removed"
    end if
    set AppleScript's text item delimiters to {""}
end tell
-- 
Barry Wainwright
Microsoft MVP (see http://mvp.support.microsoft.com for details)
Seen the All-New Entourage Help Pages? - Check them out:
        <http://www.entourage.mvps.org/>

--
To unsubscribe:
<mailto:[EMAIL PROTECTED]>
archives:
<http://www.mail-archive.com/entourage-talk%40lists.letterrip.com/>
old-archive:
<http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>

Reply via email to