Hey guys, here’s a script I found over at OS X hints.com (old habbits die hard!)
“I have Entourage set up with multiple folders for the various people I receive email from. There are some people for whom I want to keep their emails for a certain number of days before I delete them, while others I don’t care about keeping. So, I wrote the following AppleScript which looks through my folders (excluding some) and finds emails older than 60 days. The script then moves those emails to Deleted Items.”
The lines in the script you’d want to modify are:
if folderName is not equal to “Keep” and folderName is not equal to “Deleted Items” and folderName is not equal to “Archive” and folderName is not equal to “Sent Items” then
This line controls which folders not to check. There’s probably a better way of writing this line, but, being new to AppleScript, I’m not sure what it would be.
if difference is greater than 60 then
move theMessage to folder “Deleted Items”
end if
This line controls the age of the email and where to move it.
You may also want to delete display dialog "Processing folder " & folderName. I have that in there so I know which folder is currently being processed.
OS version: OS X
tell application "Microsoft Entourage"
repeat with theFolder in every folder
set theCurrentFolder to theFolder
set folderName to the name of theCurrentFolder
if folderName is not equal to "Keep" and folderName ¬
is not equal to "Deleted Items" and folderName is not equal to ¬
"Archive" and folderName is not equal to "Sent Items" then
display dialog "Processing folder " & folderName
repeat with theMessage in every message in the folder folderName
set theCurrentMessage to theMessage
try
set theDate to time received of theMessage
set difference to ((current date) - theDate) div days
if difference is greater than 60 then
move theMessage to folder "Deleted Items"
end if
end try
end repeat
end if
end repeat
display dialog "Done!"
end tell