-- Downloaded From: http://c-command.com/scripts/mailsmith/export-and-delete -- Last Modified: 2007-08-17 property pMessageThreshold : 800 property pExportFolder : "HD:Users:mjt:Mail:to file:" on run tell application "Mailsmith" if connection in progress then return set auto checking enabled to false repeat with mbox in every mailbox my recurse(mbox) end repeat set auto checking enabled to true end tell end run on recurse(mbox) tell application "Mailsmith" my processMailbox(mbox) repeat with submbox in every mailbox of mbox my processMailbox(submbox) end repeat end tell end recurse on processMailbox(mbox) tell application "Mailsmith" set n to count of messages of mbox if n > pMessageThreshold then if (every message of mbox whose seen is false) = {} then my exportMailbox(mbox) end if end if end tell end processMailbox on exportMailbox(mbox) tell application "Mailsmith" set n to count of messages of mbox activate set mboxFile to (pExportFolder & name of mbox) display dialog "Ò" & (name of mbox) & "Ó has " & n & " read messages. Will save in Ò" & mboxFile & "Ó." export mbox to mboxFile delete every message of mbox end tell end exportMailbox