how to delete single attachment in multiple attchment message

B

biernot

hi,

I have a problem one here might have already solved...

I want to let entourage automatically delete some certain attachments
like imstp.gif (produced by incredimail mailsoftware in each and every
single mail...) and only this attachment not the other ones.

As I set up a rule that deleted the above mentioned attachment,
unfortunately all attachments of the message were lost.

My question is now:

Is it possible to let entourage perform such a task?

And if so, how can it be done? Via rule or via script?

Any advice would be greatly appreciated :))

Regards
 
P

Paul Berkowitz

hi,

I have a problem one here might have already solved...

I want to let entourage automatically delete some certain attachments
like imstp.gif (produced by incredimail mailsoftware in each and every
single mail...) and only this attachment not the other ones.

As I set up a rule that deleted the above mentioned attachment,
unfortunately all attachments of the message were lost.

My question is now:

Is it possible to let entourage perform such a task?

And if so, how can it be done? Via rule or via script?

Any advice would be greatly appreciated :))

Regards

It could be done by a rule running a script.

tell application "Microsoft Entourage"
set theMsg to item 1 of (get current messages)
repeat with theAttachment in (every attachment of theMsg)
if name of theAttachment contains "imstp.gif" then
delete theAttachment
end if
end repeat
end tell


To be able to include other extensions, you could do it like this, but see
proviso following.


property badAttachments : {"imstp.gif", "imstp.jpg"}

tell application "Microsoft Entourage"
set theMsg to item 1 of (get current messages)
repeat with theAttachment in (every attachment of theMsg)
repeat with i from 1 to (count badAttachments)
set badAttachment to item i of badAttachments
if name of theAttachment contains badAttachment then
delete theAttachment
exit repeat
end if
end repeat
end repeat
end tell


Add more "bad attachments" to the badAttachmnets property as needed.

BUT: there's a bug with scripts used in Entourage script menu or run from an
Entourage rule made by Script Editor 2.0 in Panther. It won't retain the
property. You'll need to make the script in the free Smile script editor
instead : <http://www.satimage.fr/software/en/smile.html> Open a File/New
Script (not New Text) paste the script in, and save it as a Script to your
Entourage Script Menu Items.

Also send a request to Microsoft via the Help menu that they should fix the
script menu so it can run scripts made in Script Editor in Panther.

If you're in Jaguar you don't need to worry about this bug.



--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: <http://www.entourage.mvps.org/toc.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Entourage you are using - 2001 or X.
It's often impossible to answer your questions otherwise.
 
D

Dave Cortright

This script will work on any OS with any script editor:

tell application "Microsoft Entourage"
set badAttachments to {"imstp.gif", "imstp.jpg"}
set theMsg to item 1 of (get current messages)
repeat with theAttachment in (every attachment of theMsg)
repeat with i from 1 to (count badAttachments)
set badAttachment to item i of badAttachments
if name of theAttachment contains badAttachment then
delete theAttachment
exit repeat
end if
end repeat
end repeat
end tell
 
P

Paul Berkowitz

This script will work on any OS with any script editor:

tell application "Microsoft Entourage"
set badAttachments to {"imstp.gif", "imstp.jpg"}
set theMsg to item 1 of (get current messages)
repeat with theAttachment in (every attachment of theMsg)
repeat with i from 1 to (count badAttachments)
set badAttachment to item i of badAttachments
if name of theAttachment contains badAttachment then
delete theAttachment
exit repeat
end if
end repeat
end repeat
end tell

Very true. (It's OK to send my own script back like that.) I had originally
been thinking of a fancier version that would let you add bad attachment
"types" by selecting them as text, in a support script. That would require a
script property and thus a different editor in Panther. But if I were to
take it that way, I'd post the script itself at MacScripter.net in a file
that everyone could use. If you're going to edit the badAttachments
yourself, then the script above will work just fine made in any editor,
including Panther's Script Editor, as Dave says.

--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: <http://www.entourage.mvps.org/toc.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Entourage you are using - 2001 or X.
It's often impossible to answer your questions otherwise.
 
Top