[comp.sys.mac.hypercard] "Finding" but not "going"

sysop@stech.UUCP (Jan Harrington) (02/14/88)

This one's got me stumped.  As I understand, and have always used, the find
command, find locates the first occurrence of a search string and then does
a goto the location of the text.  What if I just want to know where the
text is located rather than actually going to it?

In other words, if I search a multi-line field on a specific card for a
bit of text, all I want to know is the line number where the text is found.
Can that be done?  I definitely don't want to go to that card.  I only want
that line number, which will then be used to retrieve data from another field.

I've been able to do this, by the way, by conducting a sequential search on
the field (using a counter to go from one line to the next).  It works fine,
but isn't terribly efficient.  I'm looking for something faster.  (Should I
write a binary search instead of attempting to use find?)


Jan Harrington, sysop
Scholastech Telecommunications
ihnp4!husc6!amcad!stech!sysop or allegra!stech!sysop

********************************************************************************
	Miscellaneous profundity:

		"No matter where you go, there you are."
				Buckaroo Banzai
********************************************************************************

twakeman@hpcea.CE.HP.COM (Teriann Wakeman) (02/17/88)

I think that you are stuck with Hypercard performing an autimatic goto.
you can emulate what you want by something on the order of:
lockscreen
set cursor to 4
push card
do your find
if the result is not empty then
 answer "couldn't find whatever" with "oh well..."
 exit event
end if
put your line number into a globalvariable or a field
pop card
end event

Sorry, this isn't exactly what you asked for but just an emulation of it.

TeriAnn Wakeman