Extract from digest
Extract from digest
- Subject: Extract from digest
- From: Neal Blank <email@hidden>
- Date: Fri, 25 Jan 2002 17:35:18 -0500
I'm a real newbie who has tried-- unsuccessfully -- to modify an Emailer
script so that it will work with Outlook Express 5.1. I'm running OS 8.6,
with AppleScript v1.1.3. The script, called Extract from Digest, enables
the user to highlight a single message in an email digest to save it,
reply, or forward.
Here's the script I'd like to modify:
tell application "Claris Emailer"
set theWindow to the front window
if the class of theWindow is incoming message window then
set theDate to false
set theFrom to false
set theTo to false
set theSubject to false
set theMessageID to false
set theContinuation to false
set theReplyTo to false
set theHeader to ""
set theSelection to the selection of theWindow
set theMessage to the displayed message of theWindow
set theProperties to {receiving account:receiving account of
theMessage, time received:time received of theMessage, storage:storage of
theMessage}
set theLines to the long headers of theMessage
-- Prepend the digest original headers to the selected headers
-- They will act as default values
set theLines to the paragraphs of theLines & the paragraphs of
theSelection
set headerLines to 0
-- Find the break between the headers and body
-- Also filters out (most) duplicate header lines from prepending
above, preferring the fields from
-- the selected message where there are duplicates
-- Note: see the special processing of Reply-to: below
-- Note: does not deal with continuation lines completely properly
repeat with theLine in theLines
if length of theLine is 0 then
exit repeat
else if theLine starts with "Date: " then
set theDate to theLine
set theContinuation to false
else if theLine starts with "To: " then
set theTo to theLine
set theContinuation to "To: "
else if theLine starts with "From: " then
set theFrom to theLine
set theContinuation to "From: "
else if theLine starts with "Subject: " then
set theSubject to theLine
set theContinuation to "Subject: "
else if theLine starts with "Reply-To: " then
set theReplyTo to theLine
set theContinuation to false
else if theLine starts with "Message-ID: " then
set theMessageID to theLine
set theContinuation to false
else if (theLine starts with " " or theLine starts with " ") and
theContinuation is not false then
if theContinuation is "To: " then
set theTo to theTo & theLine
else if theContinuation is "From: " then
set theFrom to theFrom & theLine
else if theContinuation is "Subject: " then
set theSubject to theSubject & theLine
end if
else
set theHeader to theHeader & return & theLine
end if
set headerLines to headerLines + 1
end repeat
set theHeader to text 2 thru end of theHeader -- trim leading return
-- Emailer seems to be sensitive to the order the headers appear in
-- This is one combination that appears to work
set theHeader to theHeader & return & theDate & return & theSubject &
return & theFrom
-- Override To with ReplyTo, don't use ReplyTo so you have a choice of
replying to
-- From or To or both. Don't override if ReplyTo is already in To
if theReplyTo is not false then
set theReplyTo to text 11 thru end of theReplyTo
if theReplyTo is not in theTo then
set theTo to "To: " & theReplyTo
end if
end if
set theHeader to theHeader & return & theTo & return & theMessageID &
return
set savedDelimiters to AppleScript's text item delimiters
try
set AppleScript's text item delimiters to {return}
set theBody to items (2 + headerLines) thru end of theLines as string
set AppleScript's text item delimiters to savedDelimiters
on error m number n from f to t partial result p
set AppleScript's text item delimiters to savedDelimiters
error m number n from f to t partial result p
end try
set theProperties to {long headers:theHeader, content:theBody, read
status:untouched} & theProperties
set newMessage to make new incoming message with properties
theProperties
open newMessage
end if
end tell
Some guidance would be warmly welcomed.
Neal
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Neal Blank
Writer/Photographer
Email: email@hidden
Web: home.earthlink.net/~nealx