• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: file is already open & file wasn't open
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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:36:37 -0700

On Apr 21, 2007, at 11:18 AM, Emmanuel wrote:

I'm not able to write to a file via an applescript unless it was opened with write permission.

"Just do it"

OK; it works with an existing file. You can't create a file and write to it without creating it with write access without closing it first.


This works:

set foo to choose file name
set bar to open for access foo
close access bar
try
	write "Hello world" to foo
	close access foo
end try
try
	close access foo
end try

This doesn't:

set foo to choose file name
set bar to open for access foo
try
	write "Hello world" to foo
	close access foo
end try
try
	close access foo
end try

-- Michelle

--
Reading computer manuals without the hardware is as frustrating as reading sex manuals without the software.
-- Clarke's sixth law


_______________________________________________
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
References: 
 >file is already open & file wasn't open (From: Gil Dawson <email@hidden>)
 >Re: file is already open & file wasn't open (From: deivy petrescu <email@hidden>)
 >Re: file is already open & file wasn't open (From: Michelle Steiner <email@hidden>)
 >Re: file is already open & file wasn't open (From: Emmanuel <email@hidden>)

  • Prev by Date: Re: file is already open & file wasn't open
  • Next by Date: Re: file is already open & file wasn't open
  • Previous by thread: Re: file is already open & file wasn't open
  • Next by thread: Re: file is already open & file wasn't open
  • Index(es):
    • Date
    • Thread