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: Cornwall <email@hidden>
- Date: Fri, 22 Feb 2002 09:16:01 -0800
At 10:38 AM -0600 2/22/02, 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 suppose to, however when it writes the text file it puts in Macintosh line breaks - no surprise...
>
>
However, the PHP needs UNIX line breaks to read the text file correctly. I can change the file in BBEDIT with no problem and could even AppleScript BBEDIT to make the change for me. If possible though, I would like to be able to do this without BBEDIT - not knocking the application, BBEDIT rocks!
One way would be with text item delimiters - if the file isn't too large.
set filRef to (open for access theFlie with write permission)
try
set theTxt to (read filRef)
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to return
set txtLst to every text item of theTxt as list
set AppleScript's text item delimiters to " " -- that should be a line feed
--character in the quotes. Eudora has converted it to a space
set theTxt to txtLst as string
set AppleScript's text item delimiters to oldDelims
set eof filRef to 0
write theTxt to filRef starting at eof
close access filRef
HTH
Corny
_______________________________________________
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.