Re: Wrapping lines
Re: Wrapping lines
- Subject: Re: Wrapping lines
- From: email@hidden
- Date: Wed, 5 Dec 2001 06:32:28 -0600
At 11:29 +0000 12/05/2001, has wrought:
>
John Fountain wrote:
>
>
>I have a script that I wrote that wraps lines of text if they are more
>
>than 31 characters long. It is basically a kludge of if...thens that
>
>gets the job done but i can't help but think there must be a cleaner way
>
>to do this. Has anyone out there written a script like this before? I am
>
>interested to see other attempts at doing this.
______________________________________________________________________
Greetings,
The WrapText osax is quite nice for this sort of thing:
http://www.bekkoame.ne.jp/~iimori/sw/WrapTextOSAX.html
-- Wrap Text
--
-- theDirectParam: string,
-- width: optional, small integer, Wrap width by bytes. Default is 76.
-- prefix: optional, string, Add this string to beginning of each lines
-- remove: optional, string, Remove this string from beginning of each lines
-- onlyLongLines: optional, boolean, Wrap only long lines
-- scriptCode: optional, small integer, Script code of text. Use system script when omitted.
-- result: string, wrapped text
WrapText theDirectParam ,
width theWidth ,
prefix "string-value" ,
remove "string-value" ,
with/without onlyLongLines ,
scriptCode theScriptCode
----------------------------------------------------------------------
set theText to "Now is the time for all good men to come to the aid of their country."
set newText to WrapText theText width 31
--> Result:
Now is the time for all good
men to come to the aid of their
country.
----------------------------------------------------------------------
Best Regards,
Christopher Stone
______________________________
StoneWorks Computer Consulting
email@hidden