Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!pasteur!agate!violet.berkeley.edu!edmoy From: edmoy@violet.berkeley.edu Newsgroups: comp.sys.mac.hypercard Subject: Re: "Repeat with...." question Message-ID: <7160@agate.BERKELEY.EDU> Date: 24 Feb 88 19:41:41 GMT References: <8232@eleazar.Dartmouth.EDU> Sender: usenet@agate.BERKELEY.EDU Reply-To: edmoy@violet.berkeley.edu.UUCP () Organization: University of California, Berkeley Lines: 63 Keywords: repeat, bug In article <8232@eleazar.Dartmouth.EDU> boz@eleazar.Dartmouth.EDU (John Boswell) writes: > I wrote a nifty (I think 8-) ) stack for keeping track of my music col- >lection and one to keep track of my library. One of the buttons in each stack >looks at all the cards and determines which items at any particular time are >out on loan to someone. This can be useful if I need to "recall" a book or >cd, or whatever, or to remind someone to return something they borrowed 6 monthsago.. > >My problem is that the button contains the following script: (in part) > >repeat with the number of cards of this bkgnd > >...do the checking > >end repeat > > Problem is, this doesn't work, and HC chokes on the "of this bkgnd". Yes, the "the number of cards" construct only works for the total number of cards in the stack, so you can't modify it with "of this bkgnd". > I tried changing to "with this bkgnd" or "in" or etc., ad nauseum, to >no avail. Can anybody tell me how to only repeat for the number of cards >in a single background??? Alternately, how do I determine the "number of >cards in bkgnd "X" "??? Try something like this: go first card of bkgnd "Whatever" put short id of this card into firstCard ...do the checking go next card of this bkgnd repeat until short id of this card is firstCard ...do the checking go next card of this bkgnd end repeat This should work but is on the slow side. If you have a field on the cards that contain the date the book was loaned out, and empty otherwise, then you can search for something like a comma in that field. go first card of bkgnd "Whatever" find chars "," in field "Loaned Date" if the result is not empty then ... nothing on loan end if put short id of this card into firstCard ...do whatever go next card of this bkgnd find chars "," in field "Loaned Date" repeat until short id of this card is firstCard ...do whatever go next card of this bkgnd find chars "," in field "Loaned Date" end repeat This is much faster if most of your library isn't loaned out. Edward Moy Workstation Software Support Group University of California Berkeley, CA 94720 edmoy@violet.Berkeley.EDU ucbvax!violet!edmoy