Path: utzoo!mnetor!uunet!husc6!bbn!rochester!ur-tut!aisl From: aisl@ur-tut (Larry Landry) Newsgroups: comp.sys.mac.hypercard Subject: Re: Searching a stack and creating a list of matching cards... Message-ID: <1964@ur-tut.UUCP> Date: 4 May 88 21:26:16 GMT References: <2051@bgsuvax.UUCP> Reply-To: aisl@tut.cc.rochester.edu.UUCP (Larry Landry) Distribution: na Organization: Univ. of Rochester Computing Center Lines: 41 Keywords: Help! In article <2051@bgsuvax.UUCP> hovan@bgsuvax.UUCP (John Hovan) writes: > > > Can anyone suggest a way to have hypercard search a stack for a key >word and print a list of all the cards that contain the word in a field? Try this script in a button: on mouseUp push card -- save the current card ask "Grep for what" -- what do you want to grep for? put empty into cardList -- start with no cards in list find it -- find 1st occurence of text put the id of this card into startCard -- save it to test for end of list repeat put the id of this card & return after cardList -- add this card to list find it -- find the next card if the id of this card is startCard then exit repeat -- are we done? end repeat pop card -- back to original card put cardList into card field "grep list" -- display the list end mouseUp This does have one known limitation; if the first card on which the string is found has more than one occurence of the string, only that card will be shown. This may be a major drawback for some applications and no problem for others. There may be a simple way around that but I haven't looked too deeply for one yet. The code that needs to be changed is the line if the id of this card is startCard then exit repeat -- are we done? > Once a list of the key words is found, I would like to be able to >print the list or click on one of the items in the list to go to that >particular card. This has been discussed in previous articles in this newsgroup. You should be able to obtain a copy from people who have been reading the newsgroup. Larry Landry University of Rochester