[comp.sys.mac.hypercard] Is it possible to test for the existance of an object?

cory@gloom.UUCP (Cory Kempf) (12/21/88)

The subject says it all.  What I want to know is, is there a way to 
test for the existance of a specific object from within a hypertalk
script?  (ie a card, button, field, etc?)  Prefferably by name?

I would rather avoid writting yet another XCMD for this if I can
avoid it.

Thanks,

+C
-- 
Cory (...your bravest dreams, your worst nightmare...) Kempf
UUCP: encore.com!gloom!cory
	"...it's a mistake in the making."	-KT

eduard@uva.UUCP (Eduard de Jong) (12/23/88)

Newsgroups: comp.sys.mac.hypercard
Subject: Re: HyperCard on floppies
Summary: Non-boot disks must be mounted by startup application.
Expires: 
References: <29693@tut.cis.ohio-state.edu>
Sender: 
Reply-To: eduard@uva.UUCP (Eduard de Jong)
Followup-To: 
Distribution: world
Organization: Faculteit Wiskunde & Informatica, Universiteit van Amsterdam
Keywords: Startup, mounting disks.

In article <29693@tut.cis.ohio-state.edu> Howard P. Marvel asks:

>	1.  How do I delay until the 2d disk is recognized?

This problem may be explained by looking at the MACs boot procedure.
It runs (scematicaly) like this:
At Boot_time only the boot disk is mounted by the boot code; the system
can subsequently be read using the standard FileManager calls.  Any
floppydrives or SCSI devices connected to the machine and recognised at
boot_time (ie powered and running) are put in the event queue with a
"DiskInsert Event" message.  However, any drivers needed for the disks
are loaded at boot_time.  Normally the Finder will directly after its is
launched cause the disks to be mounted when it discovers them at its
first calls to GetNextEvent.

This expose leads to a possible solution:
If HC, as I expect, correctly handles DiskInsert events all you need is
an Idle-handler in the Home stack that goes to your stack on the other
disk. This should work as I figure HC posts Idle messages only after it has
seen and processed any real events (like KeyDown & DiskInsert &c.).

Hope you get this working now.

--No fancy signature-- 
	Eduard K. de Jong Frz.

jdevoto@well.UUCP (Jeanne DeVoto) (12/23/88)

You can check for the existence of a card by noting that a failed "go"
command sets the value of the result function. A script would look like
this:
    on mouseDown
      lock screen  -- hide following shenanigans from users
      go to card "Am I Here?"
      if the result is not empty then
        -- card doesn't exist
      else
        -- it does exist
        go recent card -- get back where you came from
      end if
      unlock screen
    end mouseDown

The only way I know of to test for the existence of a field or button
is to use a repeat loop to step through each field (or button) on the 
current card and check whether that one is the one you want.

jeanne a. e. devoto
jdevoto@well.UUCP