Re: file is already open & file wasn't open
Re: file is already open & file wasn't open
- Subject: Re: file is already open & file wasn't open
- From: Michelle Steiner <email@hidden>
- Date: Sat, 21 Apr 2007 11:14:16 -0700
On Apr 21, 2007, at 10:44 AM, deivy petrescu wrote:
You are not opening someFile, actually AS creates a reference to
the file someFile, a number, and it works with that reference
instead of the file.
So your command generates a number say 113, now AS will work with
113 not with someFile.
Once you have this problem, quit whatever is your Script Editor and
relaunch it.
Now you can try again, but you should use:
"set ofasF to open for access file someFile with write permission"
Actually, AS lets you reference the file either way.
write v : Write data to a file that was opened for access with write
permission
write anything : the data to write to the file
to anything : the file reference number, alias, or file reference of
the file to write to
Try this:
set foo to choose file name
set bar to open for access foo with write permission
write "hello world" & return to foo
write "goodbye cruel world" to bar
close access bar
That should take care of your problem. However, better yet, be rude
and impolite, do not ask for permission just write to the file...
go ahead and just write:
write (space & someText) to FileNr starting at eof
I'm not able to write to a file via an applescript unless it was
opened with write permission.
-- Michelle
--
Impeach The Son Of A Bush!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden