Re: (ascii 10 ascii 13) --> (ascii 13) in Tex-Edit?
Re: (ascii 10 ascii 13) --> (ascii 13) in Tex-Edit?
- Subject: Re: (ascii 10 ascii 13) --> (ascii 13) in Tex-Edit?
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 18 Mar 2001 21:17:12 -0800
On 3/18/01 8:02 PM, "Bill Christens-Barry" <email@hidden> wrote:
>
 A number of text files I download contain the character pair (ascii
>
 10 ascii 13) as a line terminator, and I  can't seem to find a way to
>
 use Tex_Edit's dictionary to replace these with (ascii 13).
    tell application "Tex-Edit Plus" to replace window 1 looking for (ASCII
character 10) replacing with ""
--(or
    tell application "Tex-Edit Plus" to replace window 1 looking for (return
& (ASCII character 10)) replacing with (return)
but the first way is more concise. If you ever need to do the opposite,
putting in LF line feeds:
    tell application "Tex-Edit Plus" to replace window 1 looking for
(return) replacing with (return & (ASCII character 10))
You can also do this without recourse to TE + at all:
    set f to open for access txtFile with write permission
    set r to read f
    set AppleScript's text item delimiters to {(ASCII character 10)}
    set theParas to text items of r
    set AppleScript's text item delimiters to {""}
    set r to theParas as string
    set eof f to 0
    write r to f
    close access f
This way, you don't even have to open up the file , and it takes just a
split second.
-- 
Paul Berkowitz