Trashing attachements in Entourage

I realize that this may sound like an unusual and rather petty situation but I really need some help on an issue with Entourage in OSX. I am looking for a script that will either:
-Automatically trash docs in the Entourage Saved Attachments folder upon close of document.
-Or, ask when opening an attachment if they would like to save it?
-Or, overwrite the a previous version of a saved attachment if it has been already opened once.

Let me explain further the situation. Entourage must “save” a document when it is opened directly from an email. So it is saved in the Saved Attachments folder with the name of the attachment - ex: [Contract.doc]

Now, if a second email comes through later, with the same attachment, and you open it or if you open the original attachment again…It opens as [Contract[1].doc]. If you open it a second time it opens as [Contract[2].doc] and so on.

I have a client who is VERY PICKY :rolleyes: and he can not stand an application changing the name of a document with out “permission”. I really hope that someone can humor :oops: me and give me hand. THANKS!

Since you can’t guess when a user is opening or not an attachment, I think your best bet is attach this (or similar) script to a recurring schedule:

set sa to (path to documents folder as text) & "Microsoft User Data:Saved Attachments:" as alias

tell application "Finder" to delete every item of sa

Or use a shell script to force-remove all stuff, perhaps a bit dangerous if there is currently opened documents within such folder.

jj! Thanks so much for your reply! You are a lifesaver.

Okay I get the idea behind your script. That is perfect. Except you will have to excuse me, I am completely new at this script thing. But do not understand the language yet.

Do I need to change anything in that script you posted?
Because I didn’t and it compiled and then I tested, but am getting an error. “Can’t get <>.”

I am probably missing something really stupid. Sorry…

THANKS FOR THE HELP!

Maybe your AS version doesn’t support the “documents folder” class. Try this code instead:

set sa to (path to "cusr" as text) & "Documents:Microsoft User Data:Saved Attachments:" as alias

tell application "Finder" to delete every item of sa

Thank you so much!!! That worked perfectly!!! YOU ROCK!