Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!ukma!husc6!bbn!rochester!pt.cs.cmu.edu!cat.cmu.edu!ns From: ns@cat.cmu.edu (Nicholas Spies) Newsgroups: comp.sys.mac.hypercard Subject: Re: Faster Button Message-ID: <3179@pt.cs.cmu.edu> Date: 1 Oct 88 16:51:17 GMT References: <70621@sun.uucp> <1482@pur-phy> <547@uva.UUCP> Sender: netnews@pt.cs.cmu.edu Distribution: comp Organization: Carnegie-Mellon University, CS/RI Lines: 40 Actually, you can automate the making of buttons to an even greater extent: you can write a function, which may be passed arguments, to create scripts. Try something of the form... on makeButton cardNum, title, n, m lock screen go card cardNum doMenu "New Button" put the number of card buttons into ncb set name of button ncb to title set script of button ncb to bScript(n,m) -- probably some more stuff choose browse tool end makeButton function bScript n, m -- say n refers to a line in a global variable 'foo' and m is a factor -- that the button will multiply line n of foo by... return "on mouseUp" & return & _ "global foo" & return & _ "put line" && n && "of foo *" && m && "into message" & return & _ "end mouseUp" end bScript The script returned by bScript(10,30) should look like: on mouseUp global foo put line 10 of foo * 30 into message end mouseUp ...its just a matter of concatentating strings. The only potentially confusing thing is that you must insert "return" characters in the middle of the script string with "& return & _" where "_" is the option-return character to prevent lines from running off right end of editing dialog. Remember also that the line continuation cannot be used within a quoted string, only between them. -- Nicholas Spies ns@cat.cmu.edu.arpa Center for Design of Educational Computing Carnegie Mellon University