Re: Problems with files on OS X
Re: Problems with files on OS X
- Subject: Re: Problems with files on OS X
- From: Christopher Nebel <email@hidden>
- Date: Fri, 22 Mar 2002 11:27:21 -0800
On Friday, March 22, 2002, at 12:43 AM, Xavier Ambrosioni wrote:
I have 2 problems when I want to use files on Mac OS X :
1/ The command:
'open for access file "file.txt" with write permission'
returns en error if the file "file.txt" exists, so I can't write at the
end
of a file and I can't read a file.
If you're saying exactly that, then you're probably hitting a bug with
partial paths. AppleScript 1.7 doesn't cope well with file references
that aren't complete paths (i.e. "disk:folder:file.txt"). Use a
complete path, or install the AppleScript 1.8.2 beta, which should fix
the problem.
2/ When i use the command:
'write my_text1 & return & my_text2 to my_file starting at eof'
there is only one line in my_file. If I open the file with vi on
Terminal, I
can see the character "^M" in place of the return (or \n) character.
"return" and "\n" are not the same thing. "return" is a carriage return
(ASCII character 13, or "\r" to Unix folk), which is what Mac OS
traditionally uses to end lines. Unix, on the other hand, normally uses
a line feed (ASCII character 10, or "\n"). vi, being pure Unix, takes a
rather narrow view of the world and only treats \n as a line break, so
your file appears to only have one line. More flexible applications
like TextEdit are fine with either convention.
--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.