Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!rutgers!njin!princeton!phoenix!englandr From: englandr@phoenix.Princeton.EDU (Scott Louis Englander) Newsgroups: comp.sys.mac.hypercard Subject: Re: Question about the startUp message Message-ID: <4827@phoenix.Princeton.EDU> Date: 11 Dec 88 20:41:52 GMT References: <406@accuvax.nwu.edu.NWU.EDU> Reply-To: englandr@phoenix.Princeton.EDU (Scott Englander) Organization: Princeton University, NJ Lines: 96 In article <406@accuvax.nwu.edu.NWU.EDU> mcgee@nuacc.acns.nwu.edu (Randy McGee) writes: >I've been playing around with a startUp handler lately and am having some >problems. One of the things I'm trying to do in this stack is ensure that >the userLevel is set to 3. Since the normal hierarchy would execute my stack >startUp handler first (assuming you open the stack from the finder of course) >and then the Home stack handler, the userlevel is "set" according to the >preference card. > After many hours of trying to do this exact thing, i've come up with a way, but it's a still a pain in the butt. If Apple is at all considerate of folks like us, they'll incorporate a command in future versions, like "set local userlevel to" which only affects the current stack. The following works, but it seems to me i had some trouble in older versions of HC, because openstack was not sent when launched from the finder. I may be wrong about this, though. Here it is: -- stack script: on initlevel global savelevel, initflag if the version < 1.2 then answer "Please upgrade to HyperCard version 1.2 or greater" B with "Cancel" go home else put true into initflag hide msg set the cursor to 4 -- watch lock screen set lockmessages to true if the userlevel is not 2 then push recent card push this card go to card "User Preferences" of stack "Home" put card field "User Level" into savelevel -- closestack restores userlevel setUserLevel 2 -- typing only go to first card pop card else set userlevel to 2 put 2 into savelevel end if go to first card -- -- other initialization stuff goes here -- set lockmessages to false end if end initlevel on openstack global initflag if initflag is not true then initlevel end openstack on startup --sent after openstack when launched from the finder global finderlaunch put true into finderlaunch -- don't pass startup, as home stack will intercept and -- reset userlevel end startup on closestack global savelevel, initflag, finderlaunch put empty into initflag lock screen set lockmessages to true set cursor to 4 -- watch set userlevel to 5 domenu "compact stack" set userlevel to 2 if finderlaunch is not true then -- restore userlevel -- we don't really know what home userlevel was if we launched from -- finder, as we didn't need to go there to save it push this card go to card "User Preferences" of stack "Home" setUserLevel savelevel pop card end if put empty into initflag put empty into finderlaunch put empty into savelevel set lockmessages to false unlock screen end closestack -------------------------------------------------------------------------- Hope this helps. -- - Scott