Title: Script to extract a message from a digest
While we're on the topic of digest and scripts, I also transported a script from OE that will extract a single message from a digest. This is useful when you want to save just one or two messages out of a long digest.
Open the digest message, scroll to the message you want to save, and select it starting with the "Date" or "Subject" line, or whichever header line comes first. Select through to the end of the message and then run the script. It will create a new incoming message <from> the sender, and will give you the option to set the reply to default either to the mailing list or to the sender.
NOTE: This script does NOT work with the message selected in the digest’s preview pane; the message needs to be opened. I might be able to change that but can’t be bothered.
--- Extract Message from Digest ---
--- Adapted from existing script by Allen Watson, [EMAIL PROTECTED]
-- 10/30/2000
on maybeExtract(theWindow, theSelection)
tell application "Microsoft Entourage"
set theMessage to the displayed message of theWindow
try
set theAccount to the account of theMessage
on error
set theAccount to ""
end try
set theFolder to the storage of theMessage
try
if theAccount is not "" then
set newMsg to make new incoming message with properties ¬
{source:theSelection, read status:untouched, account:theAccount} at theFolder
else
set newMsg to make new incoming message with properties ¬
{source:theSelection, read status:untouched} at theFolder
end if
open newMsg
on error
display dialog "Message extraction failed" buttons {"OK"} default button {"OK"}
end try
end tell
end maybeExtract
on run
tell application "Microsoft Entourage"
set theSelection to the selection
-- Strip leading blanks for header lines ONLY
set howMany to count paragraphs of theSelection
set theLines to paragraphs of theSelection
set keywords to {"From:", "Date:", "Subject:"} -- Header keywords
repeat with x from 1 to howMany
set aline to item x of theLines
repeat with aWord in keywords
if aWord is in aline then
if (length of aline) > 0 then
repeat while character 1 of aline is " "
if (length of aline) > 1 then
set aline to text 2 thru -1 of aline
else
set aline to ""
exit repeat
end if
end repeat
end if
end if
end repeat
set item x of theLines to aline
end repeat
set saveit to AppleScript's text item delimiters
set AppleScript's text item delimiters to return
set theSelection to theLines as text
set AppleScript's text item delimiters to saveit
-- display dialog theSelection
if the class of theSelection is string then
set theWindow to the front window
if the class of theWindow is message window then
my maybeExtract(theWindow, theSelection)
else if the class of theWindow is draft window then
display dialog "Text in a message must be selected." buttons {"OK"} default button {"OK"}
else if the class of the displayed feature of theWindow is folder then
my maybeExtract(theWindow, theSelection)
else
display dialog "Text in a message must be selected." buttons {"OK"} default button {"OK"}
end if
end if
end tell
end run
--- end script
--
Peace,
Allen Watson <[EMAIL PROTECTED]> XNS name: =Allen Watson
A Mac family since 1984
My web page: <http://home.earthlink.net/~allenwatson/>
