meade@gauss.math.purdue.edu (Doug Meade) (09/13/89)
During the development of an HyperCard (HC) stack I have encountered several apparent limitations of HC (or my understanding of HC). I have been able to temporarily resolve all of the problems, but these solutions are hardly efficient and certainly not elegant.i Question 1: How can an application (or document) be opened if it contains a 'non-typeable' character. For example, the name of the TeX application created by Blue Sky is Textures(TM) where (TM) is the superscripted trademark symbol. When I enter the command open "File" with "Textures" in HC, the response is "Where is Textures?" since there is no application known by the name Textures. (HC correctly added the appropriate path to the Applications card of the Home stack.) I see one solution that involves changing the name of the application to something that can be typed. However this seems unacceptable on the grounds that all my existing documents that were created by Textures(TM) will not be openable by double-clicking on the icon. I imagine I could also make the modifications with ResEdit, but I am really looking for a HC solution. I would imagine that this has been previously encountered. How have you resolved the problem? Question 2: Is there a simple character replacement command within HC? I want to be able to say something like put replace("str1","str2",field "Name") into field Name1 I have written a couple of functions which implement such a function, but they are e.x.t.r.e.m.e.l.y s..l..o..w..!! Question 3: This brings up the related issue of sharing functions between more that one button/field without making multiple copies of the commands? I could see a way of doing this if I could invoke a HyperTalk command that would execute the script of a different button/field. For example: <Script for Button "B1"> on MouseUp put 0 into n repeat while n<10 do script of button "B2" go to next card add 1 to n end repeat end MouseUp <Script for Button "B2"> on MouseUp . . . end MouseUp I might also expect to use some form of the global command to make the function names known to a wider scope. Any assistance on any of these points will be greatly appreciated. Please send responses to: meade@math.purdue.edu I will summarize to the net if the interest warrants. Thanks in advance, Doug Meade meade@math.purdue.edu -- Doug Meade meade@math.purdue.edu <--- New e-mail address
bskendig@phoenix.Princeton.EDU (Brian Kendig) (09/13/89)
In article <10031@j.cc.purdue.edu> meade@gauss.math.purdue.edu (Doug Meade) writes: >During the development of an HyperCard (HC) stack I have encountered several >apparent limitations of HC (or my understanding of HC). I have been able to >temporarily resolve all of the problems, but these solutions are hardly >efficient and certainly not elegant.i An inefficient, inelegant solution is not a solution at all, in my opinion - at least not when you're dealing with an efficient, elegant program such as HyperCard. >Question 1: How can an application (or document) be opened if it contains >a 'non-typeable' character. For example, the name of the TeX application >created by Blue Sky is > > Textures(TM) > >where (TM) is the superscripted trademark symbol. When I enter the command > > open "File" with "Textures" > >in HC, the response is "Where is Textures?" since there is no application >known by the name Textures. (HC correctly added the appropriate path to >the Applications card of the Home stack.) > >I see one solution that involves changing the name of the application to >something that can be typed. However this seems unacceptable on the grounds >that all my existing documents that were created by Textures(TM) will not >be openable by double-clicking on the icon. I imagine I could also make the >modifications with ResEdit, but I am really looking for a HC solution. First of all, if you renamed Textures(TM) to Textures, then all of your "Textures(TM) document"s would become "Textures document"s. If you renamed it to "foobar", then the "Textures(TM) document"s would become "foobar document"s. They could still be opened by double-clicking on their icons. Secondly, there is no such thing as a filename that can't be typed. How do you think the creator named the file in the first place? The (TM) symbol can be typed with an Option-2. The copyright symbol is Option-G, and the Registered Trademark symbol is Option-R. If worse comes to worse and you can't figure out how to type an application's name, click on the file in question once in the Finder and choose Copy from the Edit menu to copy its name. Enter HyperCard, edit your scripts, and paste the name wherever you like. >Question 2: Is there a simple character replacement command within HC? >I want to be able to say something like > > put replace("str1","str2",field "Name") into field Name1 > >I have written a couple of functions which implement such a function, but >they are e.x.t.r.e.m.e.l.y s..l..o..w..!! No. There is no simple search-and-replace commandin HyperTalk. Either write a script to do it (which would indeed be slow unless you found some nifty way to optimize it), or write an XCMD or XFCN, or find an existing XCMD or XFCN to do the job for you. Check the ftp site at sumex-aim.stanford.edu for plenty of juicy HyperCard enhancements. (Offhand I don't know of any that will do what you want, however.) >Question 3: This brings up the related issue of sharing functions between >more that one button/field without making multiple copies of the commands? >I could see a way of doing this if I could invoke a HyperTalk command that >would execute the script of a different button/field. For example: > ><Script for Button "B1"> > > on MouseUp > put 0 into n > repeat while n<10 > do script of button "B2" > go to next card > add 1 to n > end repeat > end MouseUp > ><Script for Button "B2"> > > on MouseUp > . > . > . > end MouseUp Two easy ways to do this. The script of the second button executes anyway when it gets a mouseUp message, so replace 'do script of button "B2"' with 'send mouseUp to card button "B2"'. Or, you could move the function into the card, background, or stack scripts, wherever you think it would be most appropriate (probably the card script): on moof . . . end moof Script for button "B1": on mouseUp repeat 10 times moof go next end repeat end mouseUp Script for button "B2": on mouseUp moof end mouseUp I hope this helps! << Brian >> -- | Brian S. Kendig | I feel more like I | bskendig | | Computer Engineering | did when I got here | @phoenix.Princeton.EDU | | Princeton University | than I do now. | @PUCC.BITNET | | Systems Engineering, NASA Space Station Freedom / General Electric WP3 |
lhe@sics.se (Lars-Henrik Eriksson) (09/13/89)
In article <10031@j.cc.purdue.edu>, meade@gauss (Doug Meade) writes: >Question 1: How can an application (or document) be opened if it contains >a 'non-typeable' character. For example, the name of the TeX application >created by Blue Sky is > > Textures(TM) > >where (TM) is the superscripted trademark symbol... But the trademark symbol IS typeable! Unfortunately I can't tell you how since I have a Swedish keyboard with slightly different layout. However, you can open the "Key Caps" desk accessory and check yourself. When you press the shift or option key (or both together), the keycaps on the screen will change, so you can se where the trademark symbol is. >I see one solution that involves changing the name of the application to >something that can be typed. However this seems unacceptable on the grounds >that all my existing documents that were created by Textures(TM) will not >be openable by double-clicking on the icon.... Yes, they will. The connection between an application and its documents is completely independent from the file name of the application. You could do it this way in case you don't find the (TM) symbol. -- Lars-Henrik Eriksson Internet: lhe@sics.se Swedish Institute of Computer Science Phone (intn'l): +46 8 752 15 09 Box 1263 Telefon (nat'l): 08 - 752 15 09 S-164 28 KISTA, SWEDEN