Re: UNIX line breaks in an AppleScript created text document
Re: UNIX line breaks in an AppleScript created text document
- Subject: Re: UNIX line breaks in an AppleScript created text document
- From: Christopher Nebel <email@hidden>
- Date: Fri, 22 Feb 2002 12:59:44 -0800
On Friday, February 22, 2002, at 08:38 AM, Ron Bishop wrote:
I'm working on a project that uses a text file that is used by PHP to
set up a web site on an Apache Server (OS X). My script does everything
it's supposed to, however when it writes the text file it puts in
Macintosh line breaks - no surprise.
Here is pertinent section of my script~
if allitemsToWrite = i then
set theItemtoWrite to theItem
else
set theItemtoWrite to (theItem & return)
end if
Indeed, no surprise, since a Mac line ending is what you asked for. The
"return" property is set to a carriage return by default. Other folks
have given ways to convert an existing file, but it would be simpler to
generate the right thing to begin with. Just change the "return" to
"ASCII character 10" and you'll get a Unix-style text file that PHP
should be happy with.
(Obligatory performance note: for speed reasons, you should probably set
a variable to ASCII character 10 and use that in the loop. One
candidate, oddly enough, is "return" itself, since it's not a constant,
but a writable property.)
--Chris Nebel
AppleScript Engineering
_______________________________________________
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.