[comp.sys.mac.hypercard] How to disable command-M?

elee6o4@jetson.uh.edu (Kelvin Chi-Keung Hui, EE Depart., U. of Houston) (08/07/90)

	I'm a just a beginner for HyperCard scripting.  I wonder there is any
way I can disable the command-M message so that users cannot activate the
message box.  Or more properly, how can I check the commands such as command-H,
command-F, and etc inside a script?

	Any help will be appreciated.

Kelvin Hui
elee6o4@jetson.uh.edu

kseah@cs.utexas.edu (Kenneth Cheng-Lim Seah) (08/07/90)

In article <6730.26bd9aad@jetson.uh.edu> elee6o4@jetson.uh.edu (Kelvin Chi-Keung Hui, EE Depart., U. of Houston) writes:
>
>	I'm a just a beginner for HyperCard scripting.  I wonder there is any
>way I can disable the command-M message so that users cannot activate the
>message box.  Or more properly, how can I check the commands such as command-H,
>command-F, and etc inside a script?
>
>	Any help will be appreciated.
>
>Kelvin Hui
>elee6o4@jetson.uh.edu

Try the following script...

on doMenu cmd
  if cmd = "Message" then
    answer "Bleah!!"
  else
    pass doMenu
  end if
end doMenu

You can have a series of nested if's to check for the various other
menu calls (e.g. Help, Find... etc).  Also you could set the userLevel
property to 1 or 2 or whatever to lock out the message (I think!)

-- 
Kenneth Seah (kseah@cs.utexas.edu||PO Box 8565, Austin, TX 78713-8565)
Grad Student, Dept of Computer Sciences, University of Texas at Austin
"Money means nothing 'cause hacks are free..." (Apologies to MK)
Disclaimer:  Disclaim 'er?? Why I don't even know 'er...

taylorj@yvax.byu.edu (08/08/90)

In <10955@cs.utexas.edu>, kseah@cs.utexas.edu (Kenneth Cheng-Lim Seah) writes:

>You can have a series of nested if's to check for the various other
                         ^^^^^^^^^^^^
>menu calls (e.g. Help, Find... etc).


I don't mean to pick on the poster, but this seemed an opportune time to point
out a useful but seemingly little-known feature of HyperTalk: that you don't
need to nest if's.  E.g.

  if foo = "bar" then ...
  else
    if foo = "blee" then ...
    else
      if foo = "xyzzy" then ...
      end if
    end if
  end if

can be written much more simply and legibly as

  if foo = "bar" then ...
  else if foo = "blee" then ...
  else if foo = "xyzzy" then ...

Although HyperTalk can't do case statements (sigh...) this at least lets you
get much closer than using nested if's.


Jim Taylor
Microcomputer Support for Curriculum   |
Brigham Young University               |   Bitnet: taylorj@byuvax.bitnet
101 HRCB, Provo, UT  84602             |   Internet: taylorj@yvax.byu.edu