Re: Text delimiters and file reading
Re: Text delimiters and file reading
- Subject: Re: Text delimiters and file reading
- From: "Marc K. Myers" <email@hidden>
- Date: Thu, 09 May 2002 11:49:43 -0400
- Organization: [very little]
>
Date: Thu, 9 May 2002 16:10:29 +1000
>
Subject: Text delimiters and file reading
>
From: Lachlan Deck <email@hidden>
>
To: email@hidden
>
>
Hi there,
>
>
I've been having some fun today (not) trying to get a consistent way of
>
AppleScript recognising "\n" as it seems to not recognise this character
>
with the use of the keyword return.
>
>
i.e., if you read in some text from a file created in TextEdit - then
>
"\n" characters are not recognised as return characters - which is a
>
real bummer if you want to convert the text to a list where each line is
>
an item.
>
>
That being the case, I tried to convert the string - i.e., replace all
>
occurrences of "\n" with return - but sometimes AppleScript seems to
>
forget what "\n" is and so it stuffs up.
>
>
i.e., the following lines produce different results - they work, but the
>
first one isn't consistent as the Script Editor changes the character it
>
seems (at times)...
>
>
property retn: "\n"
>
...
>
set theEnd to (get eof from_file)
>
set theText to (read from_file from 0 to (theEnd - 1) using delimiter
>
(retn as text))
>
set theText to (read from_file from 0 to (theEnd - 1) using delimiter
>
return)
>
>
Any suggestions? This is quite annoying....
I suspect your problem stems from the fact that the backslash is an
escape character and doesn't register as part of the text. If you want
a backslash to be interpreted literally you have to double it.
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[5/9/02 11:49:19 AM]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.