RE: Is a network file in use?
RE: Is a network file in use?
- Subject: RE: Is a network file in use?
- From: "Jones, Robert" <email@hidden>
- Date: Thu, 25 Mar 2004 09:51:32 -0500
Oddly enough I've found that regardless of whether the file is open locally
or on another Mac over the network, I can write to it using the "open for
access...with write permission" and "write" events.
I got around the problem of overwriting the info already in the file by
"read"ing the contents of the file to eof, then appending the new
information in a variable before "write"ing the whole thing back into the
file.
The only glitch occurs when someone has the file open and they attempt to
save it after it has been modified via AppleScript. They get an error about
TextEdit not being able to save SimpleText files and they must provide a new
filename. Not so bad because it retains the data in the modified version of
the file, but bad for the operator because it could be confusing for them.
However, this doesn't happen very often (less than 1% of the time) so I'm
not too concerned.
But maybe things are different in Panther...
Robert
-----Original Message-----
From: Rob Jorgensen
To: AppleScript-Users
Sent: 3/25/2004 6:16 AM
Subject: Re: Is a network file in use?
At 8:14 PM -0500 3/24/04, Mark Douma wrote:
>
On Mar 23, 2004, at 1:18 PM, Jones, Robert wrote:
>
>
>I've done some reading through the archives but can't find a reference
to my
>
>specific issue:
>
>
>
>Multiple users on multiple Macs (OS X 10.2.8 at the moment, but moving
to
>
>Panther soon) opening and closing files on a network volume. Files
will also
>
>be written to (and read from) via AppleScript, but obviously can't be
>
>written to if someone already has the file open (locally or over the
>
>network... server is also OS X). How can I trap whether the file is in
use,
>
>or busy, or locked by someone?
>
>
>
>
The 'info for' command of the Standard Additions scripting addition
>
has a "busy status" property.
>
>
For example, if I run the following script in Script Editor, I'll
>
get the corresponding result:
>
>
set my_file_ to alias "mdouma46:Desktop:46.jpg"
>
set my_file_info_ to info for my_file_
>
set busy_status_ to busy status of my_file_info_
>
>
Result: false
Based on my tests in Jaguar, the result, in most cases, will be false
no matter what the actual status of the file might be. I will
continue to consider busy status useless until all applications are
required to set the flag or until the OS or Finder does it for them.
My opinion: "busy status" should be removed from the results of the
"info for" command until it returns accurate, reliable information.
-- Rob
_______________________________________________
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.
_______________________________________________
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.