Error when opening a file for access with write permission..

Hi,

I’m in the process of getting my OS9 scripts to run in X, and I’m having a problem with this one.

I’d like the script to create a file, open it for access, write something, and close for access. Something easy, like this:

tell application "Finder"
	set destFolder to alias "Hardrive:Users:Me:My folder:"
	set infoLog to make file with properties {name:"xxx"} at destFolder
	set writeReport to open for access file infoLog with write permission
	write "This is a test." to writeReport starting at eof
	close access writeReport
end tell

The file gets created, but I get an execution error on the “open for access…” part that says:

I’ve checked the Essential Sub-Routines on the AppleScript site, and everything seems ok.

Thanks.

Try this (Finder isn’t required for any of this):

set destFolder to "Hardrive:Users:Me:My folder:"
set writeReport to open for access file (destFolder & "xxx") with write permission
try
	write "This is a test." to writeReport starting at eof
	close access writeReport
on error
	try
		close access writeReport
	end try
end try

– Rob