Applescript for message creation

A

A. Seth Young

....not much of an applescripter, so I'm having trouble coming up with a
functional applescript that will take the full internet headers from
selected messages and use these full headers as the bodies of new messages,
all with the same recipient and subject. Any thoughts? Thanks. -sy
 
B

Barry Wainwright

...not much of an applescripter, so I'm having trouble coming up with a

functional applescript that will take the full internet headers from
selected messages and use these full headers as the bodies of new messages,
all with the same recipient and subject. Any thoughts? Thanks. -sy



tell app "microsoft entourage"
repeat with aMessage in (get current messages)
tell aMessage to set {theRecipients, theSubject, theHeaders} to {recipients,
subject, headers}
set newRecipients to {}
repeat with aRecip in theRecipients
copy "\"" & display name of address of aRecip & "\" <" & address of
address of aRecip & ">" to end of newRecipients
end repeat
set oldTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to {", "}
set newRecipients to newRecipients as text
set AppleScript's text item delimiters to oldTIDs
make new draft window with properties {subject:theSubject,
content:theHeaders, to recipients:newRecipients}
end repeat
end tell
 
A

A. Seth Young

Wow. With a little adjustment, your script works fabulously for my purposes.
Thanks, Barry!
 
B

Barry Wainwright

You¹re welcome :)

--
Barry Wainwright
Microsoft MVP (see http://mvp.support.microsoft.com for details)
Seen the All-New Entourage Help Pages? - Check them out:
<http://www.entourage.mvps.org/>



From: "A. Seth Young" <[email protected]>
Newsgroups: microsoft.public.mac.office.entourage
Date: Tue, 07 Dec 2004 21:34:27 -0500
Subject: Re: Applescript for message creation

Wow. With a little adjustment, your script works fabulously for my purposes.
Thanks, Barry!
 
A

A. Seth Young

Alas, my AppleScript skills have not improved much since the last time I
begged for help here. I was using the script below to quickly report spam by
sending full message headers along to my email provider, but now, instead of
sending headers, I need to forward each message along as an attachment. I
cannot for the life of me figure out how to ³forward as attachment² via
AppleScript. Any help appreciated. Thanks! -sy


tell application "Microsoft Entourage"
repeat with aMessage in (get current messages)
tell aMessage to set {theRecipients, theSubject, theHeaders} to
{recipients, subject, headers}
set newRecipients to "[email protected]"
set oldTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to {", "}
set newRecipients to newRecipients as text
set AppleScript's text item delimiters to oldTIDs
make new draft window with properties {subject:"spam report",
content:theHeaders, to recipients:newRecipients}
send window "spam report"
delete aMessage
end repeat
end tell
 
B

Barry Wainwright

There is no direct command in AppleScript to 'forward as attachment' in
Entourage. However, it i simple enough to implement a different way.

First, save the message to a temporary file:

set thePath to ((path to temporary items folder) as text) & "temp.eml"
tell application "Microsoft Entourage"
set theMessage to item 1 of (get current messages)
save theMessage in thePath
end tell

(note: you could first extract the subject of the message and use that
to set the name of the saved file, but beware of illegal file name
characters in the subject)

next, create your new email and attach this file.

when you shut down the mac, the temporary items folder will be
automatically emptied, so no need to worry about storing up gigabytes of
old message in there!
 
Top