-- Rewrap paragraphs that start with a quote char but might have been cut -- when resent as quote. This script tries to rewrap those lines. -- Uses osax WrapText (see below). -- Markus Frischknecht (mailto:mfrischknecht@access.ch) 11/8/99 -- Version history: -- 1.0 11/8/99 First version. -- This script is public domain. Use and change at will, but if you release a -- modified version please include the information above. (* WrapText osax by H. Iimori. Can be found at <http://www.bekkoame.or.jp/~iimori/indexSoftware.html> The page description and documents are Japanese. However, the entry in the dictionary of the osax should be enough to start using it: WrapText: Wrap Text WrapText string [width small integer] -- Wrap width by bytes. Default is 76. [prefix string] -- Add this string to beginning of each lines [remove string] -- Remove this string from beginning of each lines [onlyLongLines boolean] -- Wrap only long lines [scriptCode small integer] -- Script code of text. Use system script when omitted. Result: string -- wrapped text *) -- set up double tell mechanism tell application "Finder" try -- MacOS 8.0 and 8.1, but also works for Sys 7.5 and 7.6 set EU to (process 1 whose creator type is "CSOm") as «class psn » on error -- Eudora is not running, so abort beep end try end tell tell application "Eudora Pro 3.1.3" to tell EU try set currQuote to setting 7009 -- quote string set selText to selected text -- Go through each paragraph; if empty, simply insert quote char -- else use WrapText on it. set NBParagraphs to (count selText's paragraphs) - 1 set finalText to "" set paraText to "" repeat with i from 1 to NBParagraphs set varLine to paragraph i of selText if varLine is not currQuote then -- not just quote, but text line: -- add to paraText, but first add space if not present at end of line if last character of varLine is not " " then set varLine to varLine & " " end if set paraText to paraText & varLine & return else -- we found empty line (only contains quote), so rewrap paraText first, -- add it to resulting text, empty paraText, -- add empty line if paraText is not "" then set paraText to WrapText paraText prefix currQuote remove currQuote -- with onlyLongLines set finalText to finalText & paraText -- & return set paraText to "" end if set finalText to finalText & varLine & return end if end repeat -- now if still text in paraText, wrap and add if paraText is not "" then set paraText to WrapText paraText prefix currQuote remove currQuote -- with onlyLongLines set finalText to finalText & paraText -- & return end if set selected text to finalText on error -- in case no selection exist, or no editable window open beep end try end tell