• 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 for access
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: open for access


  • Subject: Re: open for access
  • From: "Nigel Garvey" <email@hidden>
  • Date: Tue, 2 Dec 2008 13:14:16 +0000

Luther Fuller wrote on Mon, 1 Dec 2008 13:31:46 -0600:

>On Dec 1, 2008, at 1:17 PM, Emmanuel Levy wrote:

>>> 	set refNr to (open for access htmlFile with write permission)
>>>
>>> but I keep getting the error -54, "File permission error". I've
>>> checked permissions and I (the current admin user) do have read-
>>> write permission.
>>
>> That's the message when another process on the same machine already
>> opened the file with that same AppleScript command. I wonder whether
>> the files opened by a process close magically when it quits. I would
>> think that no.
>
>That's what I was thinking, so the original code said this ...
>
>	try
>		close access htmlFile
>	end try
>	try
>		set refNr to (open for access htmlFile with write permission)
>
>so I shouldn't be getting the error for that reason.

A few things to consider.

An access to a file belongs to the application that opened it. In a
script, that'll be either the application running the script or, if the
'open for access' command's in a 'tell application ...' block, the target
of the 'tell'. Only that application can close (or use) the access, so
everything to do with that access has to be done under the same 'tell'
conditions.

There can only be one 'write permission' access open to a file at any one
time, but there can be several read-only ones, belonging to the same or
different applications. You can never be entirely sure you're covering
all the bases with an expression like 'close access htmlFile'.
('htmlFile', by the way, should ideally be an alias or a file rather than
just a path.)

>Perhaps I need to
>restart?

It should be enough just to quit the application that owns the access, if
you know what it is. Otherwise, restarting will quit all applications and
release all the accesses on the system.

NG

 _______________________________________________
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

  • Follow-Ups:
    • Tell Blocks Considered Harmful (was Re: open for access)
      • From: Chris Page <email@hidden>
    • Re: open for access
      • From: Emmanuel Levy <email@hidden>
  • Prev by Date: Re: INDESIGN: Hyperlinks Question
  • Next by Date: Re: open for access
  • Previous by thread: Re: open for access
  • Next by thread: Re: open for access
  • Index(es):
    • Date
    • Thread