StackClock 1.0 ****************** Written in a real hurry by Brian Tao, on the night of March 29th, 1991. One of the first things I did to my Home stack was to put a real-time clock on the first card. At first, I settled for the clock updating itself every time the first card was opened, with a script similar to this: on openCard put the abbrev date && "„" && the time into card field "Clock" end openCard Seemed adequate at the time. However, I tend to sit around in the Home stack mulling about what to do next, to the point where the clock is never accurate, and I have to resort to looking at my wristwatch (gasp!). That defeats the purpose of having an onscreen clock (so all us lazy folks donÍt have to bend our heads down or raise our forearms to tell the time). Then I discovered the ñidleî system message while browsing through the HyperTalkHelp stack. HCGS sends the ñidleî message whenever nothing is happening. The perfect solution for my clock! Change the handler above to ñon idleî, and HyperCard will update the clock whenever it isnÍt busy doing something else! Now, if you read the ñTipsî text box for the ñon idleî handler, you will find a warning which basically says annoying things will happen if you have such a handler running while you are trying to type something in a text field. If you donÍt believe me, go back to the previous card, make sure the clocks are activated, and try to type something in the small text box at the bottom of the screen. See what I mean? ThatÍs because HyperCard sends the idle message even during the pauses in your typing! So the handler obediently runs, removing the cursor from the text field and causing you endless frustration. The scripts for all the different clocks are contained in the card script (hit Apple-Option-C to read it), but there is also a copy of the individual scripts in the text fields themselves. If you want to use a particular clock in your own stack, just copy the text field over and make sure you move the script to the right place (either the card, background or stack). IÍm assuming you know how to edit scripts and that you have a knowledge of HyperTalk, because IÍm not going to explain everything in detail. Because of the way the ñon idleî handler takes over the system when it runs, donÍt put it on the same card where you might have to enter text, because it wonÍt work. The first card of the Home stack is good since the only thing you do is click on buttons. Otherwise, make yourself a button (or steal mine) which turns the clock on and off by changing the name of the handler to something like ñon nothingî (which never gets called by HyperCard). Check out the Master Control button script to see how that works. Two special scripts are included in the clock card script. The first one is an hourly chime which plays a little ditty every hour, on the hour. Type ñchimeî in the message box to hear it. The other thing is an alarm clock. To set it, turn off the clocks by clicking on the Master Control button (obviously, it should say OFF, and the light should be red). Then edit the time in the small, shadowed text field near the bottom of the screen. The script is set up such that the time you enter must be in the form hh:mm AM/PM. It wonÍt give you an error message if you type something else in „ the alarm simply wonÍt go off. The ñflashî XCMD is used in the script, so you must have the release version of HyperCard IIGS 1.0, or else it wonÍt work properly. Turn up the volume on the GS to hear Robin Williams yell at the top of his lungs when the alarm goes off... Anyway, a few final notes: this is a freeware stack „ I hope it will teach HyperTalk beginners a little bit about the language, and some techniques for combining expressions, values and string manipulation commands in a single ñputî statement. If for some reason you want to contact me, you can reach me by real mail to the following address: BRIAN TAO