Path: utzoo!attcan!uunet!know!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!midway!quads.uchicago.edu!chh9 From: chh9@quads.uchicago.edu (Conrad Halton Halling) Newsgroups: comp.sys.mac.hypercard Subject: Re: behaviour of "it" Message-ID: <1990Sep14.225756.4796@midway.uchicago.edu> Date: 14 Sep 90 22:57:56 GMT References: <1867@scott.ed.ac.uk> Sender: news@midway.uchicago.edu (News Administrator) Organization: University of Chicago Lines: 62 In article <1867@scott.ed.ac.uk> marc@cogsci.ed.ac.uk (Marc Moens) writes: > [stuff deleted] >I wanted to create a button on the Publications cards that would take >you to the appropriate card (i.e. the card of the same name) in the >Abstracts stack. I tried the following: > > get the name of this card > go to it in stack "abstracts" > >Getting the name of the card sets `it' to, for example, 'card "r22a"'. >I was then hoping the second line would get instantiated to > > go to card "r22a" in stack "abstracts" > >But that doesn't seem to be the case. I don't get an error message; >nothing at all happens. There are at least three ways to solve this problem. First, some of what was said isn't true. If you have this handler in a button -- on mouseUp get the name of this card go to it of stack "abstracts" end mouseUp -- you will get an alert box that says "Can't understand arguments to command go". Note also that 'go to card "XXX" in stack "YYY"' is bad syntax; it has to be 'card "XXX" of stack "YYY"'. (OF, not IN, if that's too subtle for you). Here's solution number one (the easiest): on mouseUp get the short name of this card go to cd it of "abstracts" end mouseUp Solutions two and three use the "do" command: on mouseUp get the name of this card do "go to " & it & "of " & quote & "abstracts" & quote end mouseUp on mouseUp do "go to " & the name of this card & " of " & quote & "abstracts" & quote end mouseUp Solution three is simply a faster version of solution two. The "do" command will often help you out of sticky situations like this in which you want what is contained in a variable to be used in a HyperCard command. -- Conrad Halling chh9@midway.uchicago.edu