Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bbn!apple!jdevoto From: jdevoto@Apple.COM (Jeanne A. E. DeVoto) Newsgroups: comp.sys.mac.hypercard Subject: Re: Help on password protection Message-ID: <26927@apple.Apple.COM> Date: 7 Mar 89 22:31:48 GMT References: <10738@pasteur.Berkeley.EDU> Organization: Apple Computer Inc, Cupertino, CA Lines: 43 In article <10738@pasteur.Berkeley.EDU> glen@cory.Berkeley.EDU (Glen Rosendale) writes: [ is making a tutorial system in HyperCard, and wants to 1) launch directly into the tutorial, and 2) prevent users from quitting to the Finder unless they have the correct password.] (I am posting this because it illustrates a general technique others may find useful.) When the user chooses a menu item, HyperCard sends a "doMenu" message to the current card. The message's parameter consists of the text of the menu item. Like many HyperCard messages, doMenu can be intercepted by a script before it is executed by HyperCard. You can set up a script to intercept the "Quit" item as follows: on doMenu theItem if theItem is "Quit HyperCard" then beep ask password "Please type the access password." if it is not "the password" then -- or whatever password you want beep answer "Sorry, you do not have authorization to Quit this stack." else pass doMenu end if else pass doMenu -- THIS LINE IS VERY IMPORTANT! end if end doMenu A few notes about this handler: - You must remember to pass doMenu commands other than Quit. If you neglect to do so, you will lock yourself out of all menu items. - You may want to trap doMenu "Open..." as well, since otherwise the user could go to another stack and Quit from there. As for your other question: you can set HyperCard as the startup application in the Finder, then place a command to go to the selected stack in the Home stack's openStack handler. jeanne a. e. devoto jdevoto@apple.com