Subject: | |
From: | |
Reply To: | |
Date: | Tue, 18 Mar 2008 00:25:12 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
On Mon, 17 Mar 2008 11:50:10 -0400, Mark Lively <[log in to unmask]> wrote:
>
>On Mar 17, 2008, at 11:24 AM, Mark J. Reed wrote:
>
<snip>
>> It would save a lot of the manual process of replying to individual
>> messages embedded in the digest..
>>
>Well we could always write a script...
Wow, a flame war on MACSCRIPT!
I get the digest. Here's how created this reply, with thanks to
Michael Schurig who wrote this in 1997:
property myReturnAddr : "Emmett Gray <[log in to unmask]>"
tell application "Eudora"
try
set qmsg to selected text
set subj to my extractField("Subject", qmsg)
if text 1 thru 2 of subj is not "re" then set subj to
"Re: " & subj
set replyTo to field "to" of message ""
set replyTo to text 5 thru -1 of replyTo -- remove
leading "to: "
set who to my extractField("From", qmsg)
set when to my extractField("Date", qmsg)
set attrib to "On " & when & ", " & who & " wrote:" & return
set msg to make new message at end of mailbox "Out"
set field "To" of msg to replyTo
set field "Subject" of msg to subj
set field "From" of msg to myReturnAddr
set msgBody to my makeBody(qmsg)
set field "" of msg to (attrib & msgBody)
on error errMsg
if length of errMsg > 255 then
set errMsg to text 1 thru 255 of errMsg
end if
display dialog errMsg buttons {"OK"} default button 1
end try
activate
end tell
on extractField(fldnm, msg)
set fldLen to (count characters of fldnm) + 1
repeat with x from 1 to (count paragraphs of msg)
set theLine to (paragraph x of msg)
set fldOff to (offset of (fldnm & ":") in theLine)
if fldOff is not 0 then
set fld to text ((offset of ":" in theLine) +
1) thru -1 of theLine
exit repeat
end if
end repeat
if fldOff is 0 then error "No " & fldnm & " found in the
selected text."
repeat while first character of fld is " "
set fld to text 2 thru -1 of fld
end repeat
return fld
end extractField
on makeBody(msg)
-- remove headers (they're separated by a blank line)
set off to offset of return & return in msg
set msg to text (off + 1) thru -1 of msg
-- add quote chars
set replyMsg to ""
repeat with x from 1 to count paragraphs of msg
set replyMsg to replyMsg & ">" & paragraph x of msg & return
end repeat
return replyMsg
end makeBody
|
|
|