• 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: When is a file open but not open?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: When is a file open but not open?


  • Subject: Re: When is a file open but not open?
  • From: Emmanuel <email@hidden>
  • Date: Sat, 6 Aug 2005 10:56:50 +0200

At 5:20 PM -0400 8/5/05, deivy petrescu wrote:
1 - you need sequential access: for instance, you want to write several things one after the other:

write "hello"
write " "
write "world"

I disagree with you here Emmanuel.

When you write you can write wherever you want. You have to let the script know where you want to write to.
So "write to file starting at (you fill this)" works the same way whether opened for access or not.
You can try.

I find it not always easy to "fill this". Tell me how you would store several records without opening the file (both for writing and for reading) like in:


set r to open for access f with write permission
write {name:"deivy"} to r
write {name:"emmanuel"} to r
close access r

set r to open for access f
set x to read f as record
set x to read f as record
close access r

x's name

2 - you need to be sure that no-one is also writing to the file: open with write permission does lock the file - actually I think it's the OS' genuine mechanism to lock whatever resource might be accessed by several clients.

Here, I really do not know and yield to Emmanuel's knowledge.

I would not do that.

There are ways around this. You could lock and unlock the file as needed.

Maybe you're right, I don't know to what extent a "locked" file is locked. locking is something you have Finder do? Can you be sure it's synchronous? OMM Finder's "set locked to true/false" cycle is 12 times slower (25 ms) than the "open for access/close access" cycle (2 ms.)


Emmanuel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: When is a file open but not open?
      • From: deivy petrescu <email@hidden>
References: 
 >RE: When is a file open but not open? (From: "Grimm, Kenneth" <email@hidden>)
 >RE: When is a file open but not open? (From: Emmanuel <email@hidden>)
 >Re: When is a file open but not open? (From: deivy petrescu <email@hidden>)

  • Prev by Date: Safari bookmarks - adding
  • Next by Date: Re: When is a file open but not open?
  • Previous by thread: Re: When is a file open but not open?
  • Next by thread: Re: When is a file open but not open?
  • Index(es):
    • Date
    • Thread