>I have been working with MailSmith lately, almost made it to a total
>switch, but I decided to switch back to PowerMail after all.
>
>There is one feature which really is great, and what I think would have
>to be AppleScriptable. (I think Mailsmith uses quite some AppleScripts
>in its internals):
>Move Duplucate Messages to Trash.
>
>It filters on Message-Id, which is embedded in the full headers of each
>mail message.
>
>It is a great wat to clean up after imports, or messed up POP-servers.
>
>I have just gone out and bought some AppleScripts manuals to teach
>myself what is necessary to do this myself, but.....
>
>Is there anyone (Wayne perhaps) who has this script available, or some
>pointers?
Here is one I wrote this AM for you...
-- Begin AppleScript
(* Delete Duplicates
Written by: Wayne Brissette
No extensive testing was done, use at your own risk
*)
set AppleScript's text item delimiters to {""}
set TID to AppleScript's text item delimiters
set NewTID to "Message-id: "
set AltTID to "Message-ID: "
set Alt2TID to "Message-Id: "
(* There may be other versions of Message ID, if the script fails,
check the spelling of Message ID and put it above, then add another
test for count again. *)
set IDStorage to {}
set PMID to {}
set good_IDs to {}
tell application "PowerMail"
set MyMessage to current messages
repeat with i in MyMessage
set MyNewMessage to i
set TheHeaders to (headers of i) as string
(* Test for which version of Message ID is used *)
set AppleScript's text item delimiters to NewTID
set X to count of text items of TheHeaders
if X is 1 then
set AppleScript's text item delimiters to AltTID
end if
set X to count of text items of TheHeaders
if X is 1 then
set AppleScript's text item delimiters to Alt2TID
end if
set TempID to text item 2 of TheHeaders
set AppleScript's text item delimiters to return
set Mess_Id to text item 1 of TempID
(* Mess_Id now contains the message ID of the email *)
set AppleScript's text item delimiters to TID
-- Have to place AS TIDs back to normal
(* The meat of the script. checks to see if ID has been used
if it has, it deletes the message, it doesn't pass go, it
doesn't
collect $200 dollars... it deletes it. *)
if good_IDs contains Mess_Id then
delete i
else
set good_IDs to good_IDs & Mess_Id
end if
end repeat
end tell
-- End AppleScript
---
Get your facts first, and then you can distort them as much as you please.
- Mark Twain
OP LoftBed Preferred Builder: http://www.wbwoodworks.com/
Wayne's Music Calendar: http://ical.mac.com/wayneb/Music
PowerMail AppleScript Archives: http://www.ctmdev.com/tools/
Music Currently playing: