[comp.sys.mac.hypercard] Looking for XCMD/XCFN to eject disk and to shutdown

matt@avalon.eecs.nwu.edu (Matt Larson) (01/11/91)

As the subject line says, I'm looking for two HyperCard XCMD/XCFN's.

First, I would like to be able to eject the disk in the first floppy
drive from within HyperCard -- I don't want the users to need to know
about Command-Shift-1.  (Or is it Command-Option-1?  I can't seem to
remember when I'm not at a Mac keyboard...)

Second, the Mac being used is dedicated to the HyperCard application I
have written.  I would like to be able to shutdown the Mac from within
HyperCard.  I don't even know if this is a realistic request -- I am
admittedly not a Mac programmer, so I don't know if this shutdown
procedure can be initiated from within an application or if it is
implemented in the Finder.

If anyone has these XCMD/XCFN's, or could point me in the right
direction, I would really appreciate it.

Thanks for your help.

--
Matt Larson, Distributed Systems Analyst
Academic Computing and Network Services, Northwestern University
matt@acns.nwu.edu   (708) 491-5366

tisue@tartarus.uchicago.edu (Seth Tisue) (01/13/91)

In article <47997@apple.Apple.COM> jkc@Apple.COM (John Kevin Calhoun) writes:
>
>In article <2509@casbah.acns.nwu.edu> matt@acns.nwu.edu (Matt Larson)
> writes:
>>               I would like to be able to shutdown the Mac from within
>>HyperCard.
>
>This is not a good thing to do.  Unfortunately, there's no way to guarantee,
>if you shut down the Macintosh from within HyperCard, that HyperCard will
>have written everything out to the disk that has to be written in order to
>keep the stack in a consistent state.  In other words, shutting down the
>Macintosh from within HyperCard is a common cause of stack corruption.

Comments:

1) Why couldn't a hypothetical ShutDown XCMD tell HyperCard that it needed
to finish cleaning house, so to speak?  i.e., have HC do whatever it does
before it quits to the Finder or opens another application.

2) I _have_ a ShutDown XCMD (which I got off one of the common library
stacks, don`t remember which) and have used it to shut off my Mac hundreds
of times and have never had any problem with stack corruption, which leads me
to believe that it does correctly take care of what needs taking care of.
Works in 2.0, too.

kraig@biostr.washington.edu (Kraig Eno) (01/16/91)

matt@acns.nwu.edu (Matt Larson) writes:
>I would like to be able to shutdown the Mac from within HyperCard

jkc@Apple.COM (John Kevin Calhoun) replies:
>This is not a good thing to do.  Unfortunately, there's no way to guarantee,
>if you shut down the Macintosh from within HyperCard, that HyperCard will
>have written everything out to the disk that has to be written ...

Would it work to use HyperCard's "open" command?  You can, for example, 
open Microsoft Word from within a script.  Could you make a small 
application called "Shutdown" (it probably already exists somewhere) and 
do the command

    open "Shutdown"

from within your script?  I would assume that HyperCard must do all its 
cleaning up before running a different app, but that's not necessarily the 
case, I suppose.


Kraig Eno, kraig@biostr.washington.edu
"Problems generate new knowledge" - M. Usui