• 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: Open files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Open files


  • Subject: Re: Open files
  • From: Nigel Garvey <email@hidden>
  • Date: Sat, 16 Mar 2002 17:06:45 +0000

Paul Berkowitz wrote on Fri, 15 Mar 2002 21:02:11 -0800:

>On 3/15/02 8:33 PM, "Shane Stanley" <email@hidden> wrote:
>
>> On 16/3/02 2:58 PM +1000, Paul Berkowitz, email@hidden, wrote:
>>
>>> In the event that a script is aborted when a file which has been opened
>for
>>> access (esp. with write permission) is still open, is there any way to
>ask
>>> the system to return file reference numbers of open files, so that one
>can
>>> close access of them instead of having to reboot?
>>
>> Why not just close it by path?
>
>I thought I recalled that it wasn't supposed to work reliably if you had
>opened it with write permission, or that you couldn't write to it again. I
>thought that the instance which was opened with write permission needs to be
>closed by file reference. Nigel went into this exhaustively at one time, I
>recall. Perhaps that was with an earlier, faulty version of Standard
>Additions. I seem to recall changes being made in both v1.5.5 and 1.6, maybe
>1.7.

My exhaustive tests were with AS 1.3.7 - and my conclusions were later
confirmed by simply reading the AS Scripting Additions Guide. 8-\

When an open file's referred to by path, the system uses the first
existing 'open for access' reference for that file that comes to hand. If
there's only one such reference, closing the file using the path closes
that reference and all's well.

That's the likely situation, but it's possible for a file to be open
several times at once, each opening having its own reference and
associated file pointer. Only one of these references can have write
permission. If that's the reference you've lost, you'll have to keep
closing the file by path until the appropriate reference surfaces and its
closure enables you to reopen the file with write permission. This may
have implications for other processes which haven't lost their references
and are trying to read the file.

NG
_______________________________________________
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.

  • Follow-Ups:
    • Re: Open files
      • From: John W Baxter <email@hidden>
    • Re: Open files
      • From: Paul Berkowitz <email@hidden>
  • Prev by Date: Re: Entourage close main window
  • Next by Date: Re: "play sound"
  • Previous by thread: Re: Open files
  • Next by thread: Re: Open files
  • Index(es):
    • Date
    • Thread