• 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: writing data to a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: writing data to a file


  • Subject: Re: writing data to a file
  • From: Arthur J Knapp <email@hidden>
  • Date: Wed, 01 May 2002 09:13:51 -0400

> Date: Tue, 30 Apr 2002 16:54:05 -0400
> Subject: Re: writing data to a file
> From: Stephen Swift <email@hidden>

> At 4/30/02 12:02 PM, Kinsella, John R. (email@hidden) Wrote:
>
>> My roadblock is that I can't seem to
>> figure out how to access and write to a file more than once. I can create a
>> new txt file and add data to it once, but after that, I'm informed that
>> there is a duplicate file and the script errors out.

> Hmm... Are you clossing access to the file? You must do that before you
> open it again or it will give you an error.

> set selected_file to choose file
> set fileref to open for access selected_file with write permission
> write "text 1" & return to fileref
> close access fileref
> --Important Step!
> set fileref to open for access selected_file with write permission
> write "text 2" & return to fileref starting at eof
> close access fileref

This works, but it isn't good advise. Having called the "open for access"
method, you can read and write as much as you want, followed by a single
call to "close access".

I'm not sure what could cause the original posters's problem, perhaps
he could post a little bit of the code he is using?


{ Arthur J. Knapp, of <http://www.STELLARViSIONs.com>
<mailto:email@hidden>
try
<http://www2.linkedresources.com/tools/carthandle.html>
on error number -128
end try
}
_______________________________________________
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.

  • Prev by Date: Shell Question? Help please.
  • Next by Date: Re: Learning Apple Script
  • Previous by thread: Re: writing data to a file
  • Next by thread: Re: writing data to a file
  • Index(es):
    • Date
    • Thread