[comp.sys.mac.hypercard] Looking for a way to gracefully open a file

shaul@suna.CMI.COM (Shaul Markovitch) (01/19/89)

I would like to be able to open a text file that resides
 on an appleshare server. If the file is already open by other
users, HyperCard will alert me with a dialog box.
  
I would like to be able to open the file from a script
and be able to check if an error occurred (like any normal
open command).

Is there anyway to achieve it through HyperCard (I believe 
that the answer to this one is - no)

Is there an XCMD that opens a file in a graceful way ?

If not, is there an XCMD that checks if a file is already open?

dan@Apple.COM (Dan Allen) (01/28/89)

In article <170@suna.CMI.COM> shaul@suna.CMI.COM (Shaul Markovitch) writes:
>I would like to be able to open a text file that resides
> on an appleshare server. If the file is already open by other
>users, HyperCard will alert me with a dialog box.
>  
>I would like to be able to open the file from a script
>and be able to check if an error occurred (like any normal
>open command).

An XCMD could be written (very few lines of C or Pascal) that would
open a file.  Such an XCMD would need to call FSOpen or PBOpen or Open
(all variations on a common theme).  All of these calls return a status
result.  If non-zero, then an error (such as the file already being open
read/write) is returned.  Such functionality is NOT build in to
HyperCard.

 
Dan Allen                **  dan@apple.COM (Unix mail)   **
Software Explorer        **  ALLEN.DAN (AppleLink)       **
HyperCard Team           **  20525 Mariani Ave. MS 22AE  **
Apple Computer           **  Cupertino, CA 95014         **

***********************************************************
** Sam:    "You know what they say, 'You can kill more   **
**          flys with honey than with vinegar.'"         **
** Woody:  "I don't mean to butt in, but you can kill    **
**          the most with dead squirrels."               **
***********************************************************