Re: duplicate filename error, broken file commands in 10.2?
Re: duplicate filename error, broken file commands in 10.2?
- Subject: Re: duplicate filename error, broken file commands in 10.2?
- From: John Delacour <email@hidden>
- Date: Sat, 23 Nov 2002 23:03:18 +0000
- Mac-eudora-version: 5.3a9
At 8:41 am +1100 24/11/02, Peter Gort wrote:
I am unable to open an existing file using the "open for access"
command. I am also unable to read an existing file by just
executing "read <path to file>" I get unexpected end of file error
(-39).
That would be normal.
tell current application
open for access "Mac OS X:Developer:Examples:About Examples.rtf"
--> Duplicate file name. Mac OS X:Developer:Examples:About Examples.rtf
You cannot open for access a string. It is also not necessary to
check for the existence of a file, since 'open for access' will
create it if needs be.
set tmp to ":private:tmp:"
set pathname to "" & alias tmp & "junk.txt"
--> "dx:private:tmp:junk.txt"
open for access file pathname with write permission
--> 62 or any number
set eof FILE pathname to 0
write "hello" to FILE pathname
close access FILE pathname
read FILE pathname
--> "hello"
Some people use the reference number, but I prefer always to refer to
'file pathname', since this remains constant, whereas the refnum will
change every time you open the file for access.
JD
_______________________________________________
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.