Text delimiters and file reading
Text delimiters and file reading
- Subject: Text delimiters and file reading
- From: Lachlan Deck <email@hidden>
- Date: Thu, 9 May 2002 16:10:29 +1000
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....
Thanks.
with regards,
--
Lachlan Deck
email@hidden
_______________________________________________
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.