🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #4453

Re: 3 HyperCard queries

#4453
From: Brian Kendig
Date: Tue, 12 Sep 1989 22:48
122 lines
4964 bytes
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     |
Technical Details
Message-ID: <10388@phoenix.Princeton.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!udel!princeton!phoenix!bskendig
References: <10031@j.cc.purdue.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!udel!princeton!phoenix!bskendig
From: bskendig@phoenix.Princeton.EDU (Brian Kendig)
Newsgroups: comp.sys.mac
Subject: Re: 3 HyperCard queries
Message-ID: <10388@phoenix.Princeton.EDU>
Date: 12 Sep 89 22:48:35 GMT
References: <10031@j.cc.purdue.edu>
Reply-To: bskendig@phoenix.Princeton.EDU (Brian Kendig)
Organization: Systems Engineering, NASA Space Station Freedom Project
Lines: 122