UNIX line breaks in an AppleScript created text document
UNIX line breaks in an AppleScript created text document
- Subject: UNIX line breaks in an AppleScript created text document
- From: Ron Bishop <email@hidden>
- Date: Fri, 22 Feb 2002 10:38:26 -0600
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!
Eventually the text document will be replaced with a MySQL database, so
this isn't the end of the world. But I was curious if this could be done.
Here is pertinent section of my script~
set theMainDriveName to name of startup disk
set testForFile to (theMainDriveName &
":Users:krbishop:Sites:online_databases:image:list.photos") as text
if alias testForFile exists then
my FolderAlreadyExists(testForFile) -- a simple handler
else
make file at alias (theMainDriveName &
":Users:krbishop:Sites:online_databases:image:") with properties
{name:"list.photos", file type:"TEXT"}
end if
set theFile to result as alias
set fileRef to (open for access theFile with write permission)
set i to 1
repeat allitemsToWrite times
set theItem to item i of theFileList as text
if allitemsToWrite = i then
set theItemtoWrite to theItem
else
set theItemtoWrite to (theItem & return)
end if
write theItemtoWrite to fileRef
set i to (i + 1)
end repeat
close access fileRef
If you need more, please let me know.
Thanks,
Ron Bishop
Macintosh Systems Administrator
The Kansas City Star
1729 Grand Boulevard
Kansas City, Missouri 64108
(816) 234 - 4943
_______________________________________________
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.