Re: Saving an attachment from Entourage
Re: Saving an attachment from Entourage
- Subject: Re: Saving an attachment from Entourage
- From: Allen Watson <email@hidden>
- Date: Thu, 08 Nov 2001 09:06:51 -0800
On 11/7/2001 3:12 PM, "John Tuttle" <email@hidden> wrote:
>
I've tried a number of ways to save an attachment but I get a "Can't get
>
attachment of incoming message...' error on every try.
>
>
I've seen a few references to this in the Script Archives but I haven't come
>
across a solution yet.
Here is a segment of code that is saving attachments in Entourage. It's from
a script called oddly "!Claris It!", because it was originally written (not
by me, I just converted it to Entourage) for Outlook Express to emulate
behavior of Claris Emailer.
If you would like to see the rest of the script, such as the handlers that
clean up the file name,the script can be found on my scripting web page:
<
http://homepage.mac.com/allenwatson/>
This part is inside a "tell application "Microsoft Entourage"" block:
tell theMsg
set newContent to ("Attachments saved to disk:" &
return)
set theDetails to ""
if encoding of attachment 1 is in {binhex, AppleDouble}
then -- avoid crash from null data handler returned for file type of non-Mac
files
try
set theTypes to file type of attachments
set theCreators to file creator of attachments
set theAttachmentCount to the number of
attachments of theMsg
repeat with m from 1 to theAttachmentCount
set theDetails to theDetails & (name of
attachment m) & " (" & text 8 thru 11 of ((item m of theCreators) as text) &
"/" & text 8 thru 11 of ((item m of theTypes) as text) & ")" & return & my
makeURL(my stripper(attachment m)) & return
end repeat
on error
say "Error path"
set theDetails to theDetails & my
makeTheDetails(attachments)
end try
else
say "Not binhex"
set theDetails to theDetails & my
makeTheDetails(attachments)
end if
set content to newContent & theDetails & "--------" &
return & return & content
delete attachments
end tell