FAQ Home | HC-FAQ 1 | HC-FAQ 2 | HC-FAQ 3 | HC-FAQ 4
Welcome to the HyperCard FAQ - Part 3 of 4 - Scripting ====================================================== FAQ Version 1.2.2 Tuesday, Nov 18, 1997 TABLE OF CONTENTS ----------------- FAQ Version History Foreward for Version 1.2 Introduction ------------- Add your $.02 Copyright Info Easy View and Setext New in HyperCard FAQ 1.2.1 New in HyperCard FAQ 1.2 New in HyperCard FAQ 1.1 General Scripting ------------------ How can I learn scripting? Why do scripts speed up with repeated use? How can I stop a script from running? When should I save my script? The lines in the script editor are too long. Home Stack Specials How can I select multiple buttons or fields? Can I script menu commands? How long can a variable name be? Can I add color to my stacks? How do I create pop-up menus on a card? What is the maximum capacity of a field in HyperCard? How can I get more than 30K in a field? What are resources? How do I install resources in my stacks? How do I create a PICT resource? Can I auto-compact my stacks? How can I create stand-alone applications with HyperCard? Save As Application Not Available Standalones as HOME What is Hypertext? Misc. ------ Are there programs like HyperCard for ...? Where can I get the Power Tools stack? How do I use QuickTime in HyperCard? How do I refer to a QuickTime movie window? Is it OK to install fonts in stacks? I'm going to try installing the fonts anyway, do I use ResEdit? What are the correct parameters for the picture command? SuperCard vs. HyperCard 1 SuperCard vs. HyperCard 2 How close are HyperTalk and SuperTalk? Problems --------- Why scripts don't work. My visual effect commands don't work. My userLevel won't stay at 5 (scripting). Selecting text from a script doesn't work. The text insertion point disappears when opening. What does the padlock in the menubar mean? What does "Error XXXX" mean? Error on compacting? How can I script the polygon tool? XCMDs & XFCNs -------------- What's the difference between an XCMD and an XFCN? Where can I find an XCMD/XFCN to do such-and-such? How can I get Balloon Help in my stacks? Can I test the state of a specific pixel? How can I create a custom palette? Palette TIP Admin ------ Acknowledgments Who's Peter Fleck? FAQ Versions ------------ Interim Organic FAQ v.0.0.2 by Dave Lorand released in October, 1993 Version .04 released in November, 1993 Version 1.0 released in 1994 Version 1.1 released in 1995 Slight modifications 7/20/96 AND NOW version 1.2, released on Monday, December 9, 1996 It's been a long, strange trip. Version 1.2.1 released Monday, December 23, 1996 Have a happy HyperCard holiday and script safely. -------------------- SEE THE FAQ ON THE WEB! <http://www.glasscat.com/hypercard> [Please be patient for the current version.] -------------------- Foreward for Version 1.2 ------------------------ Apple is still alive and kicking and HyperCard seems to be making a comeback. Me, I've delved into Macromedia Director and learned some things about the DOS/WINDOWS world and my own conclusion is that there's still nothing in the scripting/authoring world like HyperCard. Long live Bill Atkinson. This may be the last version of the FAQ for HC 2.x. Rumors of HC 3.0 are hot and heavy with folks seeing it more often than Elvis and it hasn't been released yet (as of this writing). My guess is Q2 of '97. The FAQ addendum contains what's known in the civilized world about 3.0. Join the mailing list or news group to keep up with the latest rumors or go to MacWorld or the WWDC for a preview. Mine was not the only FAQ in HC history -- several of us got the FAQ idea about the same time and Dave Lorand got tired of waiting for my FAQ and released the Interim Organic FAQ. (Dave continued to help with the FAQ thru 1996.) I *think* Bruce Carter was also preparing a FAQ and kindly sent me his archive. Seeing I didn't really understand the amount of work involved, everyone deferred to me. I thought it would be easy. It's not which is why this is the first big update in quite a while. I want to thank hypercarders everywhere for all of the support and help I've received in the process of putting this document together. Peter Fleck, Keeper of the HyperCard FAQ December 9, 1996 Introduction ============ A Listing of Frequently Asked Questions and Information about the HyperCard Programming Environment Part 1 is general information and a full table of contents. Part 2 is meant as an introduction to the HyperCard environment. Part 3 covers scripting. Part 4 is an addendum that covers multiple topics of more recent interest than the previous FAQ files. I'm hoping to do more frequent updatings within the addendum. Current versions of the FAQ are available for anonymous ftp from ftp://members.aol.com/petefleck/hcfaq.sit.hqx [You'll also find links to downloading at: <http://www.pfhyper.com/>] The purpose of The HyperCard FAQ is to provide information and answer basic questions about HyperCard; its scripting language, HyperTalk; and various resources and products relating to HyperCard. When I first released the FAQ, Apple was still bundling the "real" HyperCard application with new Macs, sans documentation. One of my goals with the FAQ was to provide some very basic documentation for those curious about following the HyperCard path. Today, Apple only includes the HyperCard Player; to script and author, you have to buy HyperCard and you get all the manuals. You should also consider some third-party books -- check the Books section of this FAQ for more info. The HyperCard FAQ is not meant to replace the Apple manuals, or the excellent third party books available. Editorial comments are in brackets ([]). Script commands and internet addresses in text appear between <> (except where I forgot to use these conventions). Add your $.02 ------------- Comments, suggestions, ideas, typo lists, are welcome and appreciated. [I know I didn't proof this version as well as I should have.] I can be reached via the internet at: pfhyper@aol.com or pf@pfhyper.com Copyright Info -------------- This document may be copied and redistributed on the understanding that NO resale of this information is undertaken by any recipient. This means non-profit, non-commercial publications (user group newsletters, for example) can reprint the FAQ but that it cannot be used in a book or commercial magazine. Individual authors who contributed to the FAQ still own the copyright on their material. Any reproduction of the information should be complete and entire and provide reference to the original source (i.e. the HYPERCARD FAQ) and the editor (Peter Fleck), and individual authors where directly mentioned in the text. The editor would like to be informed of any reprints and would very much appreciate a copy of the publication. The editor takes no responsibility for any errors, omissions or misunderstandings, however induced! Easy View and Setext -------------------- [I have a 7500 with System 7.5.5 and Easy View still works with no problems. 12/9/96] This document is formatted as setext. You can use the Easy View structured text reader to browse the FAQ. Easy View divides the FAQ into chapters and heads and has search capabilities. Easy View is available for anonymous ftp from <mac.archive.umich.edu> in directory /mac/util/text. [Info from the Easy View Read Me] Easy View is an application for intelligent browsing of collections of structured text files, large or small. It allows very fast access by recognizing the internal structure. All of the following text formats can be viewed using Easy View: - setext, including TidBITS and similar publications - Info-Mac, c.s.m.p, or similar digests - Mail collections: Internet, Navigator, Notebook, etc. - Text with "simple" format - Dictionaries - Plain text Written by M. Akif Eyler, Bilkent University, 06533 Ankara, Turkey. e-mail: eyler@trbilun.bitnet eyler@bcc.bilkent.edu.tr Setext More information can be obtained from the designer Ian Feldman <setext-list@random.se>, or by sending "setext" alone on the subject line, no quotes, to <fileserver@tidbits.com> New in HyperCard FAQ 1.2.2 -------------------------- Updated "HyperCard Info Resources" (Part 2) to reflect the new mailing list. Also some other minor updating of that section. Added some new info from Paul Foraker about the resizing windows. (Part 4). Corrected some errors. New in HyperCard FAQ 1.2.1 -------------------------- Jacque Gay reported some 8-bit characters in the text which caused her problems when uploading the FAQ files to AOL. I think I've removed them via the Convert to ASCII... extension in BBEdit. Added "Where did the Button Tasks button go?" in part 4, Bugs section. Added "How do I extract my original stack from a stand-alone?" in part 4, Misc. section. Added "How can I get my HyperCard stack on the web?" in part 4, Misc. section. Added Mark Gregory's HyperCard tutorial site: <http://www.chepd.mq.edu.au/boomerang/teachhc/> in part 2, The Basics, "HyperCard Info Resources". Added short blurb about my home page in the Introduction section. Added Jacque Gay's name to the people I thank in Acknowledgements. Added Peter Brigham's name to the people I thank in Acknowledgements for his "FAQ to stack" work. Updated info on Michael Swaine's HyperPub publication in part 2, The Basics, "HyperCard Info Resources". There is a web site: http://gate.cruzio.com/~mswaine/HyperPub/HyperPubHome.html New in HyperCard FAQ 1.2 ------------------------ Added a new Part 1 which contains a full table of contents and general info. Part 4, The Addendum is all new. Updated URLs and put them in standard format. Added some URLs for downloading x-things. Updated titles and ISBNs for Winkler's, Kamins's, & DeVoto's _The Book_ and Goodman's Complete Handbook. New introductory section. Updated "Are there programs like HyperCard for ...?" with new information about Oracle Media Objects, MetaCard, and HyperCard IIGS Added info about TrueColor and OpenStack. Did some other stuff I can't remember. New in HyperCard FAQ 1.1 (1995) ------------------------ What's the background domain? What's the card domain? How many stacks can I have open at once? Will my HC 2.2 stack work with earlier versions of HC? My color standalone has no color! Can I add color to my stacks? [Moved from HC Scripting FAQ] My visual effect commands don't work. [Moved from HC Scripting FAQ] HyperCard doesn't work on my PowerMac. What is the merryxmas virus? What is the HC virus? Reporting bugs and suggesting improvements. Minor changes, additions, or updates were made to the following FAQs ----------------------------------------------------------- Where Can I purchase HyperCard? HyperCard Info Resources Where can I find HyperCard stacks? (ftp info) What is the HyperCard Player? What is AppleScript? What is Home? Books on HyperCard Book Reviews HyperCard Products and Related Applications General Scripting ================= How can I learn scripting? -------------------------- by Michael Nieckoski <0005392263@mcimail.com> There are 4 ways that I suggest to learn basic (and beyond) scripting. 1) Read two or three good reference books and keep them at your side. Danny Goodman's _The Complete HyperCard Handbook_ is a great one to start with. [The documentation that comes with the retail HyperCard package is also an excellent resource.] 2)Take apart other stacks. There is nothing like learning from something that you know works! Look at the scripts throughout the entire HC hierarchy (button, field, card, background, stack, Home, Hypercard). Use your reference books to explain the commands you don't recognize. When you see how things work in the stack, you can change the variables to see how the scripts might work in your own stacks. 3) Use the Message Watcher (type "mw" into the message box on any unlocked stack). The Message Watcher is usually used for de-bugging stacks, but it is also a good way to see what commands are given how they effect the stack operation. The Message Watcher will give you ideas on which commands are used, how frequently, and where in the hierarchy they are placed. 4) Stay in touch with all of the electronic support groups available. There are people there that can answer most of your questions. Don't forget, they've been where you are -- and not so long ago! Keep in mind that HyperTalk is a very intuitive language. If you want to go to a card called "ThisCard," the script syntax is: go to card "ThisCard" -- which is elegantly simple. So often I have stumbled on to the correct command by simply picking the one or two words that clearly describe what I want to do. [In addition to Michael's ideas, use the Debugger (v.2.0 and later) and follow a script line by line and try to understand what's going on. If you purchased HyperCard, explore the Readymade Buttons and Fields Both have interesting and innovative scripts. The Power Tools stack also has good example scripts.] Why do scripts speed up with repeated use? ------------------------------------------ by William J. Brown-Stone <brownw@IBM.CL.MSU.EDU>, Dan Crow <d.n.crow@open.ac.uk>, Juan Ingles <ou90392@deere.com> Scripts are computer programs written in the HyperTalk programming language. Before version 2.0 of HyperCard, these scripts were "interpreted". This means that HyperCard examined each line of the script in turn, and converted it into the Macintosh machine code before executing it. The conversion process is relatively slow, so, as each line had to be converted every time it was used, scripts ran fairly slowly. In HyperCard version 2.0 and later, the first time a script is run, it is compiled. This involves HyperCard converting all of the lines of the script into a more compact internal representation of the script. This process takes some time to perform, but once the script is in the internal format, interpreting it a line at a time is much quicker than interpreting the original script. Thus, the first time a script is executed it runs slowly, as it is compiled into the internal form (technically known as intermediate code). Subsequent executions of the script run much faster, as HyperCard interprets the intermediate code rather than the HyperTalk script. The compiled version of the handler will be retained in memory until you quit HyperCard or until HyperCard runs out of memory to compile additional handlers. When the latter happens, HyperCard purges one or more previously compiled handlers to acquire additional space. If the purged handlers are called again, they will need to be compiled again. Because of the way this works, a 2MB memory partition for HyperCard generally results in optimum script execution speed because that is enough memory to hold most scripts in memory without purging and recompiling every time a new script is called. What the incremental compiler does should not be confused with what a "true compiler" does, which is create machine language program code. That kind of compiling is done to produce XCMDs/XFCNs and is what you get from CompileIt! from Royal Software and from C or Pascal compilers. The incremental compiler goes through the process of checking the handler for syntax errors and building a table to library routines used by the handler. As long as the handler does not change (which causes it to be recompiled) and the compiled version is still in memory, the error checking doesn't have to be done repeatedly and the table of library routines is still good. Scripts can be "primed", which is useful when you have a stack with handlers that are dependent on timing (like animation). The trick is to call your handlers one time before hand so that they are compiled. The best time is usually at startup or on opencard. To keep your handlers from executing when you prime them you can either set a global or pass a parameter that tells the handler not to execute. Examples on startup --priming method 1 global Primed put false into Primed --start priming ExampleHandler get Examplefunction () -- finished put true into Primed end startup on OpenCard --priming method 2 ExampleHandler empty,empty,true get Examplefunction (empty,empty,true) end OpenCard on ExampleHandler x,y,DoPrime if DoPrime is true then exit ExampleHandler --method 1 global Primed -- method 2 if Primed is not true then exit ExampleHandler --handler code goes here.... end ExampleHandler function Examplefunction x,y,DoPrime global Primed --method 1 if Primed is not true then return empty -- method 1 if DoPrime is true then return empty -- method 2 --function code goes here.... end Examplefunction How can I stop a script from running? ------------------------------------- Command-period (.) will stop a script unless the cantAbort property is set to true. Command-option-period (.) will break into the Debugger. When should I save my script? ----------------------------- Modifications to a script MUST be saved before the script will use them. The easiest way to save and return to your stack is to press the Enter key (not return) which closes the Script Editor window and saves. If you want to leave the Script open, choose the save command from the file menu (or type command s) before you try to run the script. If you leave a script editor window open without saving, HyperCard will run the last saved version. The user is not notified. If you set a debug checkpoint in the script, HyperCard will switch to the debug mode (debug checkpoints don't have to be saved) and warn you that the script has changed. If you continue running the script, it will run the last saved version. The lines in the script editor are too long. -------------------------------------------- Use an option-return to split a HyperTalk command over more than a single line. A character that looks like an "L" turned on its side will appear. You can break a command line just about anywhere except within quoted text. Home Stack Specials ------------------- Following are help and utility scripts in the Home stack script of HyperCard 2.1. Many of them also work on previous versions (and I'm assuming there available in 2.2). Try them from the message box. help <topic> - Opens online help and searches for topic. hyperTalk <topic> - Opens HyperTalk help and searches for the topic. nav - opens palette navigator c - Opens Card Info dialog b - Opens Background Info dialog s - Opens Stack Info dialog mw - opens Message Watcher vw - opens Variable Watcher se - use to set script editor font and script editor font size ss <pattern>,<stackname> - searches all scripts of stackname for pattern xy - puts mouse coordinates in message box How can I select multiple buttons or fields? -------------------------------------------- HyperCard will only allow you to select one button or field at a time. However, you can make multiple selections through scripting or use the Super Grouper part of the Power Tools stack. Can I script menu commands? --------------------------- Use the doMenu command. For example, to delete a card through a script use: doMenu "Delete Card" Make sure the text in quotations exactly matches the menu command you are accessing. If the menu command contains an ellipsis (...), you must include it and use three periods -- not the ellipsis character. How long can a variable name be? -------------------------------- According to Winkler and Kamins in _HyperTalk 2.2: The Book_, comments and blank lines are stripped before runtime and make no difference in speed, and short variable names also have no impact on speed. Both of these are listed as myths on pages 49. And longDescriptiveVariableNames do make program code so much more readable and understandable, for yourself 6 months to a year from when the code was written and for anyone trying to learn from your code. Can I add color to my stacks? ----------------------------- You can add color PICT images to HyperCard using the picture XCMD that comes with HyperCard. [See the 'What are the correct parameters for the picture command?' question in this FAQ] A borderless picture can be added that looks like it is part of the card. Clicking on the picture sends the <mouseDownInPicture> and <mouseUpInPicture> messages. Using the QuickTime XCMD that is part of the QuickTime Tools stack is another method. A movie can be borderless and does send messages when clicked (<mouseDownInMovie> and <mouseUpInMovie>). If you have HyperCard 2.2, you have the Color Tools stack which allows colored buttons, colored fields (but not text), colored backgrounds and importing colored pictures that can be on either the card or background layer. It is slow and there are limitations such as colored pictures having to use the system palette. But it's very easy to use and great for basic color work. This stack uses the AddColor XCMD. Beyond basic use, it's fully scriptable and Color Tools includes documentation. AddMotion II, (bundled with HyperCard 2.2 and 2.3) gives HyperCard color capability in the form of color animations. [AddMotion is considered to be VERY buggy. If you work with it, save often.] TrueColor from Alain Stadler: http://www.Generation.NET/~alainsta/x/trueColor.html [No experience with this product.] InColor from Royal Software. This is a commercial product that consistently gets good reviews. (Royal bought Heizer Software.) http://www.royalsoftware.com/ QuickColor Library by Harry Alloul ($10 shareware). I'm looking for a review of this. Fairly new as of late 1996. Very nice web site (if a bit slow). Web: http://www.netinfo.fr/objectivesw/ email: objectivesw@dial.oleane.com The Colorizing HC XCMD is an alternative to Apple's AddColor XCMD. It's available via ftp. [See Part 1 of the FAQ for info on where it's available.] HyperGasp from Caliban Software is a commercial product used for multimedia creation in HyperCard including color. [Part 1 of the FAQ has more info on HyperGasp.] Also available for adding color to HyperCard (and I'm afraid I don't have more info): HyperTint HyperCard Color Dr Nigel Perry <N.Perry@massey.ac.nz> has developed the following externals for color buttons and color text (these are Dr. Perry's descriptions): Pictoids Package - Any-shape you like colour buttons based on pictures (PICT's) or movies (QuickTime) i.e. a button with a movie "label" is entirely possible... Colour Text Package - colour text in fields Available: most archive sites (Pictoids is now v1.2 - check) and <smis-asterix.massey.ac.nz> Cost: postcard for personal & educational use to non-shareware authors add a shareware fee waiver for me if you're a shareware author commercial use etc. can be licensed. My son gets postcards :-) How do I create pop-up menus on a card? --------------------------------------- HyperCard 2.2 now has this ability. There are also several externals available. Two are FullHPop by Frederic Rinaldi and HierPopUp by Jon Pugh. What is the maximum capacity of a field in HyperCard? ----------------------------------------------------- by William J. Brown-Stone (aka Bill Brown) <brownw@IBM.CL.MSU.EDU> I've received what I think are sufficient requests to warrant posting this and the following related message to the list once again. In writing this I have gone through all of the HYPERCRD list messages I was able to collect about the topic. I have tried to include the essence of those messages but, in the interest of brevity, in many instances I have not included the full content. Even so, brevity is not my long suit, as I am afflicted with terminal wordiness, and the following is quite long. CAPACITIES AND INDICATORS: There are two different capacity limits for fields in HyperCard. 1. The maximum number of characters you can put into a field is 30,000. [In _HyperTalk 2.2: The Book_ (Winkler-Kamins-Devoto), 29,996 is stated as the limit. PF] This capacity limit is in force no matter what font or font size you are using for the field. If you attempt to put more than 30,000 characters into a field, HyperCard simply will not allow it. When you are typing into a field and exceed this limit, HyperCard displays the following message: Can't type more than 30,000 characters into a field. If you exceed the limit while pasting text into a field you get the following message: The clipboard is too big to paste. If you exceed the limit with a HyperTalk command from the message box or within a script you get the following message: Fields can't hold more than 30000 characters. [In 2.2 the message is: Fields and buttons can't hold more than 30000 characters. PF] 2. There is a maximum limit of 32,786 on the total height (in pixels) of the text in a field. You can calculate the TotalTextHeight of a field: TotalTextHeight = number of lines in the field * the textHeight of the field It is important to note here that when a line of text is long enough to wrap onto two lines of the field, that line counts as two lines in the above calculation. That is, if the text in a field wraps, you cannot use the HyperCard command line <the number of lines in field x> to get the correct number of lines to do the TotalTextHeight calculation. This will be discussed further below. For the purposes of this discussion, we will refer to this type of field capacity limit as the FieldTextHeightLimit. To put a slightly different spin on the problem, you can think about the FieldTextHeightLimit as being a limit on the number of lines of text you can put into field, given the textHeight of the field. You can calculate the MaximumNumberOfLines: MaximumNumberOfLines = 32,768 / textHeight of the field Again, this is only a correct statement if the text lines don't wrap in the field. Since this is an undocumented feature, when you exceed the FieldTextHeightLimit for a field, there are, as you might suspect, no overt or direct error messages. The only indication that you have exceeded the fieldTextHeightLimit is that the gray area of the scroll bar goes white, the same as when there are not enough lines in the field to make scrolling necessary. [When playing with this 'feature,' I did get the following message: This field contains text whose total height is greater than 32000 pixels. You may encounter problems while scrolling or editing it. Try cutting or deleting several lines of text. However, I didn't get it consistently. PF] Note: To exceed the FieldTextHeightLimit requires a great number of text lines and/or a large font with a moderate number of text lines be put into a field. Therefore, it is reasonable to assume that any field where this problem is likely to occur will be a scrolling field. The limit exists for non-scrolling fields as well, but none of the discussion leading up the writing of this FAQ document has focused on non-scrolling fields. The only time that the problem would be likely to arise for non-scrolling fields would be when text is put into the field from a script and the solution to the problem would be the same no matter what style of field is used (see below). When the FieldTextHeightLimit has been exceeded, the scroll bar will not work properly. It's behavior is sufficiently bizarre to defy succinct description. Since it is a situation to be avoided or corrected as soon as possible, there is little need to dwell on it here. For those of you who yearn for complete understanding and the full experience of life and want to experiment with this odd behavior, 1. Type a few short lines into a field. [Increasing the font size to something outlandish like 72 points will produce the effect more quickly. PF] 2. Assuming the field is a card field named "Notes", type the following into the message box: put cd fld "Notes" after cd field "Notes" 3. Press the Return key repeatedly until the scroll bar goes white 4. Play. After the scroll bar has turned white you can apparently continue to put text into the field but I've observed some strange cursor behavior while doing this and I don't think it's prudent to rely on being able to store additional text in such a field. To restore the scroll bar to it's normal functioning, you must delete some number of lines from the field so as to reduce the total number to or below maximumNumberOfLines or, stated another way, reduce the TotalTextHeight to less than 32,768. [_The Complete HyperCard Handbook 2.2_ (Goodman) says: These limits are imposed by the TextEdit routines in the Macintosh Toolbox, upon which HyperCard must rely for localization purposes. PF] How can I get more than 30K in a field? --------------------------------------- by Geoff Duncan <gaduncan@halcyon.com> HyperCard fields are limited to 32K (30,000 characters or 32,786 total height, in pixels, of the text) and there's no way to increase that limit. However, there are several workarounds that let you manipulate more than 32K worth of data, or even make a field "seem" like it holds more than 32K: 1) Use multiple fields. You can either split the information into chunks and store each chunk in a different field, or else have a single "master" field in which information is displayed from many different source fields. While an individual field is limited to 32K, the number of fields in a stack is limited only by disk space. 2) HyperTalk containers (variables) can hold more than 32K of information. (The actual capacity of a HyperTalk container is limited only by the amount of RAM available to HyperCard.) If you are simply using fields as a place to store information for your scripts, you can keep them in global variables--just remember to put empty into them when your stack closes! 3) Oftentimes large chunks of information (particularly text) is best stored in external files, separate from the stack itself. This information can then be read in by a HyperCard script, processed, and displayed for a user. This method is often used for data obtained from external sources (text files off the Internet, for example). Using these methods, any number of workarounds for the 32K limit have been implemented by HyperCard developers. What are resources? ------------------- by Jay L. Cross <by303@cleveland.Freenet.Edu> Macintosh applications (and often the documents they create [and HyperCard stacks are documents]) are composed of numerous "building blocks". These building blocks are things like icons, sounds, fonts, patterns, program code, dialog and alert boxes and their messages, and many others. In general, all the familiar Macintosh interface elements are resources. Building applications as collections of resources has many advantages, including (but not limited to): Customization - by adding to or altering the resources of a document or application, you can change things like beep sounds, colors, menu contents, and command keys, icons, etc. Shared resources - many resources, like mouse pointers, fonts, sounds, desktop colors/patterns, icons, etc. are the same across many applications. Much of this stuff is stored in the System, so it doesn't have to be duplicated many times over in the applications available for your Mac. At the very least, this saves disk space. It also results in the consistency we find across many Mac applications. Other benefits are (somewhat) easier translation of applications into non-English languages, and improved memory management. When you create a palette with the Palette Maker, you are adding to your stack a PICT and a PLTE resource. When you record a sound into a stack with the Audio palette, you are adding a snd resource. When you create an icon with the icon editor, your are adding an ICON resource. And, of course, all XCMDs and XFCNs are resources, many of which contain other resources. How do I install resources in my stacks? ---------------------------------------- 1) If you purchased HyperCard, use the Resource Mover in the Power Tools stack. Click the light bulb icon for documentation. 2) Use the ResCopy stack, free, and available by ftp. 3) Use ResEdit. How do I create a PICT resource? -------------------------------- [This description is extracted from the HyperTint documentation stack. It is copyright 1992 Symplex Systems and may only be reproduced if it is unaltered and if this notice is included.] ---------------------------------------------------------- Creating and Installing Picture Resources -------------------------------------------- HyperTint can access pictures stored as PICT resources inside the stack or as external PICT files. Many color graphic programs allow saving an image as a PICT file. Sometimes the program will refer to color PICT files as "PICT 2": this refers to the version of Apple's PICT format that supports color images. It may be less obvious how to create a PICT resource that can be copied into a HyperCard stack. Some programs may provide a menu option for creating a PICT resource, but most do not. It is still possible to create a PICT resource from almost any graphic program, using the standard Macintosh copy-and-paste sequence. Stage 1: Copy the image into the Scrapbook ---------------------------------------------- While most graphic programs don't have a "Save as PICT Resource" menu item, they will allow copying a picture to the clipboard. Most programs will transfer a PICT resource to the clipboard when the user selects the "Copy" menu item. The steps are: 1) Select the graphic image to copy. For paint programs, this will usually be done using the rectangular "selection" tool. 2) Use the "Copy" menu item to put the picture onto the clipboard. 3) Open the Scrapbook and use the "Paste" menu item to save the picture in the Scrapbook. This allows us to retrieve the picture resource using ResEdit, ResCopy, or Resource Mover. This stage can be repeated several times, storing several pictures in the Scrapbook before proceeding to the next stage. The Scrapbook should be closed before proceeding to the next stage, so that the Scrapbook file can be opened by the resource copying tools. Stage 2: Copy the PICT resources into the stack ------------------------------------------------- The Scrapbook stores pictures as PICT resources in a file called (not surprising) "Scrapbook File" that resides in the System Folder. Your favorite resource copying tool -- ResEdit, ResCopy 2.0, or the "Resource Mover" card in the "Power Tools" stack -- can be used to copy the resources into the stack. These are the same tools that can be used to install the HyperTint externals into a stack. Check the user documentation for these tools for details. Some notes: * In order to open the Scrapbook File from the Resource Mover card, you must hold the Option key when clicking the "Open" button. To open the Scrapbook file from ResCopy 2.0, click the "Open" button and then select the "All resource files (read only)" radio button. * If you forgot to close the Scrapbook before proceeding to this stage, you will not be successful in opening the Scrapbook File. The exact problem depends on the tool you are using: - ResEdit will display an error message: "File already open from another application." - ResCopy 2.0 will not show it at all in the list of files in the "Open File" dialog box. - The Resource Mover card appears to open the Scrapbook File, but no resources are shown in the scrolling list. If any of these problems occur, simply close the Scrapbook and try again. * Resources can be referred to be either name or ID number. The Scrapbook uses ID numbers to keep track of picture resources. Scripts will usually be more readable if pictures are referred to by name. After copying the picture resource, the copy of the resource in the stack can be assigned a name. The resource ID should also be changed to a positive number (1000-32767 is the suggested range): the Scrapbook uses negative ID numbers which are reserved for use by the system software. - To change a resource's name or ID using ResEdit, select the resource and then choose the "Get Resource Info" menu item. - To change a resource's name or ID using ResCopy 2.0, select the resource in the scrolling list and then choose the "Rename" or "Renumber" menu item from the "ResCopy" menu. - To change a resource's name or ID using the "Resource Mover" card, select the resource in the scrolling list and then click the "Edit" button. * If the scrapbook contains many pictures, it can be difficult to tell which picture corresponds to which ID. - If using ResEdit, there's no problem: the latest versions of ResEdit display miniaturized pictures - If using ResCopy 2.0, again there's no problem: double-clicking a PICT resource in the scrolling list will display a window containing that picture. (For this to work, you either have to invoke the ResCopy XCMD from the ResCopy 2.0 stack or use the command start using stack "ResCopy 2.0". The picture display feature depends on a handler in the ResCopy stack script. - If using the "Resource Mover" in the "Power Tools" stack, unfortunately, there is a problem. The Resource Mover does not provide a way to preview PICT resources. The only thing to do is to copy all the PICT resources into the destination stack and then use HyperCard's picture command (or HTChangePict or HTAddPict) to determine which picture is which before renaming and renumbering the desired pictures. Any unwanted pictures can be eliminated by using the Resource Mover's "Remove" button. Life is easier if you've started the whole PICT creating process with an empty scrapbook file: that way, you know that all the PICTs in the scrapbook are ones that have to be transferred. * If using ResEdit, "Copy" the PICT resource from the Scrapbook File rather than using "Cut". Modifying the Scrapbook File could confuse the Scrapbook desk accessory. Bypassing the ScrapBook ------------------------------------------------- If using either ResEdit or ResCopy 2.0, copying the pictures into the scrapbook is an unnecessary step. If a picture has been copied to the clipboard, both ResEdit and ResCopy 2.0 allow the using the "Paste" menu item to create a new PICT resource in a stack. See their user documentation for details. Can I auto-compact my stacks? ----------------------------- Place one of these handlers in your Home Stack script to automatically compact stacks when the free size reaches certain limits. on closeStack if the freeSize of this stack > .25 * the size of this stack then doMenu "Compact Stack" pass closeStack end closeStack You can change the percentage (.25) in the script to suit your sense of "how much is enough". However, as the size of the stack becomes larger, any given percentage value allows larger and larger amounts of free space to build up before the stack is compacted. For example, if you have a stack that is 100K in size, using a .25 compaction threshold will cause the stack to be compacted when the free space reaches 25K. If you have a 1000K stack, it won't be compacted until free space reaches 250K. If this is a problem for you, one solution is to decide on an absolute value (say 100K) for the amount of free space you want to allow to accumulate and change the above handler to: on closeStack if the freeSize of this stack > 100 then doMenu "Compact Stack" pass closeStack end closeStack Or you can have the best of both worlds: ["~" = line continuation] on closeStack if the freeSize of this stack > .10 * the size of this stack~ or the freeSize of this stack > 100 then doMenu "Compact Stack" pass closeStack end closeStack How can I create stand-alone applications with HyperCard? --------------------------------------------------------- HyperCard 2.2 has the ability of creating stand-alone applications by choosing Save a Copy from the File menu. Choose Application from the File Type menu. Other methods of creating a stand-alone include: Double-XX from Royal Software. There is reportedly a stack compiler included for fairly simple stacks. It's not an official part of the package. SuperCard creates standalones and HyperCard stacks can be converted to SuperCard projects. You will probably have to do some rescripting. [Converting HyperCard stacks to SuperCard is becoming more difficult as the two programs are following different paths.] Save As Application Not Available --------------------------------- If the Save as Application (or Custom File Type) is not available when you choose Save a Copy from the File menu, you probably don't have the StackToApp extension correctly installed or you're using System 6 (the HyperCard Reference Manual says you need System 7.x to create applications). On my system, when I did a standard HyperCard install, the StackToApp extension ended up in a Stack Translators folder within the HyperCard folder itself and it works fine. Danny Goodman's _The Complete HyperCard Handbook 2.2 says it should go in the Extensions folder in your System Folder. I tried this and it also works just dandy. You don't need AppleScript installed to Save As an application. (I mention this only because I saw a message on the Internet saying you do.) Standalones as HOME -------------------- When you create a stand-alone application, the stack embedded within the stand-alone application becomes the Home stack for the application. Therefore, it inherits all of the responsibilities of the Home stack, including that of storing search paths for stacks, applications, and documents. In order to support the search paths for stacks, applications, and documents in a stand-alone application, the embedded stack needs to have three cards named "Stacks", "Applications", and "Documents". Each of these three cards needs to have a background field named "paths". This is where the search path information will be stored. What is Hypertext? ------------------ Hypertext is non-sequential writing or branched text that allows the reader to choose their own pathway through the material, following their interests or a current line of thought. The writer, unrestricted by sequence, may create new forms of writing which better reflect the content of the writing. At a very basic level, we're talking about interactive footnotes. You click on the footnote, and there's the note. And since we're in a multimedia environment if the footnote refers to a city in Spain, you can bring up a map of Spain. Clicking on the city could then give you the option of either getting statistical info about the city or a street map. Soon you're lost in the back alleys of Madrid. In a hypertext system, it's very important to make the reader feel comfortable and oriented. The reader has to have a sense of location and a way to get back where they started. HyperCard is a natural for exploring hypertext concepts. One of the challenges in any hypertext systems is how to indicate the active (or clickable) text and many solutions have been toyed with. Apple responded to this challenge with version 2.0 of HyperCard with new functions -- clickChunk, clickLine, clickText, -- and with a new text style called group which places an two pixel gray line under the grouped text. Any text can be scripted as active but using the group style does have some advantages. It allows you to group a phrase so when you call one of the new click functions, you get the phrase and not just a word or character. The gray-line grouped text indicator can also be turned on and off with the <show groups> and <hide groups> commands. (Issuing these commands changes ALL stacks. Be careful and reset the group visibility if you change it.) The following handler, placed in a locked field, provides a simple link between a text chunk in that field and a hidden card field with the name of that text chunk. on mouseUp if the textStyle of the clickChunk = "group" then show card field the clickText end mouseUp Misc. ===== Are there programs like HyperCard for ...? ------------------------------------------ ToolBook from Asymetrix is not entirely compatible with HyperCard but with ConvertIt from Royal Software, you can convert HyperCard stacks to ToolBook applications, with a minimum of effort. [ConvertIt is no longer supported by Royal.] Asymetrix 206-637-1500 ObjectPlus Corporation makes HyperPlus which converts HyperCard stacks so they are able to run under Windows in the company's WinPlus authoring environment which is supposed to be similar to HyperCard. Pricy alternative. WWW: http://www.objectplus.com/ email: 75702.727@compuserve.com Phone: 617-491-7575 FAX: 617-491-1964 MetaCard is a cross-platform multimedia authoring tool and GUI development environment for Unix/X11 workstations and Microsoft Windows 95 and NT. There is a convertor ap to convert Mac HyperCard stacks to MetaCard. Somewhat pricy but you get Unix and Windows compatability. MetaCard Corporation 4710 Shoup Pl. Boulder, CO 80303 303-447-3936 303-499-9855 (fax) email: info@metacard.com Web: http://www.metacard.com Oracle Media Objects Oracle Corporation 500 Oracle Parkway Redwood Shores, CA 94065 415-506-7000 Web: http://www.oracle.com/ HyperCard IIGS is a version of HyperCard that runs on Apple IIGS computers. It is substantially identical to HyperCard Mac 1.2.5, with the addition of color and some additional HyperTalk commands. It is classified as system software and is available for free download from Apple ftp sites and Apple software areas on AOL, CIS and Genie. HyperMover is a pair of stacks that converts stacks (excluding XCMDs and XFCNs) between the Macintosh and IIGS platforms. [WindowCraft is no longer sold or supported.] WindowCraft from WindowCraft Corporation is a true HyperCard 1 superset! You receive a product to automatically convert HyperCard stacks to WindowCraft applications. It's good but with many bugs. Windowcraft Corporation 1000 Main Street Acton, MA 01720-9859 508-263-7674 508-263-4158 fax 800-828-2268 orders [Plus is no longer sold or supported.] Plus, from Spinnaker, runs in the two environments (MacOS and Windows). On the Mac side, Plus can open HyperCard stacks and convert them to Plus format. Spinnaker Software 201 Broadway Cambridge, MA 82139 617-494-1200 Linkway, which may or may not be for Windows [more info, anyone?] HyperSense runs on NeXTStep. HyperSense Thoughtful Software 616 East Locus Fort Collins, CO 80524 303-221-4596 Where can I get the Power Tools stack? -------------------------------------- It's not freeware or shareware. It's part of the retail version of HyperCard and to the best of my knowledge, was never released to the public. How do I use QuickTime in HyperCard? ------------------------------------ Claris released a QuickTime Tools stack in 1992 that allows you to play and control QuickTime movies in HyperCard. The stack is now part of the retail HyperCard 2.2 package. It contains the necessary externals and online documentation. [Other external commands are available for working with movies. I hope to report on these in future versions of the FAQ.] Exploring the QuickTime Tools stack will teach you how to use the various commands and properties. But you may somehow have access to the externals without having access to the Tools stack so here's the basic command for getting a movie displayed. movie <file name>,<window style>,<location>,<visible>,<layering> File Name ---------------- The name of the movie file. Use a full path name if the movie is not in the same folder as the stack. Window Style ---------------- Optional. One of the following: windoid, tallWindoid, plain, zoom, dialog, shadow, rect, borderless. Default: windoid. Location ---------------- Optional. Determines where the movie window is displayed. Acceptable values are a point, a rectangle, or one of these four literals: "card", "largest", "deepest", "main". Default: "card". Point: Movie at default size with top-left at point specified. Rectangle: Movie sized to fit. Top-left is coordinate within the card window. Card: Centered on screen with current card. Largest: On the screen with the largest viewing area. Deepest: Centered on the screen with greatest bit depth. Main: Centered on the "main" screen. Visible ---------------- Optional. Options are "visible" and "invisible". By creating an invisible movie, you can then set properties of the window before showing it. Default: "visible". Layering ---------------- Optional. Options are "floating" and "nonFloating". "Floating" places the movie window in the same layer as the palette windows. "NonFloating" places the movie window in the same layer as the card and script windows. Default: Determined by window style. Plain and zoom styles open in the card layer, the rest open in the floating area. How do I refer to a QuickTime movie window? ------------------------------------------- Once a movie is displayed with the <movie> command, you refer to it as a window as in: close window "myMovie" Windows also have numbers and ids so the following will work if you know the id or number: close window 1 close window id 98760 As with cards, buttons, fields, etc., the number can change but the id can't. Is it OK to install fonts in stacks? ------------------------------------ Apple Developer's Technical Support (DTS) and the HyperCard team recommend against it. It causes certain problems with printing and heap fragmentation. On the other hand, lots of people do it, so weigh the options yourself. It's safer to send along a suitcase. I'm going to try installing the fonts anyway, do I use ResEdit? --------------------------------------------------------------- No. Use Font/DA Mover. Unless you know exactly what you are doing, you can easily mess up the installation with ResEdit. Use Font/DA Mover and hold down the option key when opening the destination. That will allow you to open any file, not just another suitcase. Font/DA Mover will make sure the font is installed correctly. What are the correct parameters for the picture command? -------------------------------------------------------- The picture command allows you to display a color or greyscale PICT in HyperCard. Documentation is in the Power Tools stack (Picture XCMD). The parameters are: picture <name of PICT>,<type>,<window type>,<visible>,<bitdepth> o name of PICT = the name that the PICT file or resource has been assigned o type = file, clipboard or resource o window style = plain, rect, zoom, document, windoid, roundrect, shadow etc. o visible = true or false o bitdepth = 0,8,16,32 In conjunction with this command you can set many properties of picture windows: set <property> of window "pict_name" Below is a sample script to display a PICT file in a rectangular window on a card, 36 pixels from left edge and top. PICT file is 160 pixels wide by 230 pixels high. on displayPicture picture "picture",file,rect,false set the loc of window "picture" to 36,36 set the visible of window "picture" to true end displayPicture SuperCard vs. HyperCard 1 ------------------------- by Martin Hill <M.B.Hill@info.curtin.edu.au> Some of the reasons I like SuperCard: Having color object-oriented draw and bitmap graphics and easy animation compared to a gross b/w bitmap or cludgy color XCMDs is a godsend. Seeing a listing of all your windows, cards and resources and being able to select and edit whole groups is bliss compared to stupid HC. And then there's the ability to select and edit multiple buttons, fields and graphics at the same time without having to recourse to silly things like SuperGrouper and the other Power Tools. The list goes on... Now if only Aldus was able to find a buyer for SC who could develop it further and fix the problems. [SuperCard was purchased by Allegiant in early 1994. Allegiant is made up of several of the original SuperCard developers.] The popular perception is that SuperCard is slowwww. This is true, but I've found that all the authoring environments around tend to be slow, particularly when working with color. HyperCard, Authorware and ToolBook all have proved to be pretty abysmal on lower end Macs and PCs. MacroMedia Director is perhaps an exception, but it's memory requirements, frustrating programming language and lack of the card metaphor limit it. (not to mention its price!) I've run some benchmarks and found that SC was quicker card to card than HyperCard when both had simple black and white bitmaps and a few buttons and fields on each of the sample cards. When the bitmaps were replaced by simple draw graphics in SC, it was even faster than HC. In color, SC was also faster than HC with the latter using any of the common color XCMDs like QTPict etc. SC slowed down when multiple draw graphics were grouped together to make more complex graphics, but turning the grouped graphics into paint objects sped things up again. SuperCard vs. HyperCard 2 ------------------------- by Bob McBurney, <mcburney@memex.weeg.uiowa.edu> Most people focus on colors when they talk about SuperCard's advantages. So I'm going to be very long winded and talk about its other advantages. Windows ----------- SuperCard supports multiple windows. Each window is the equivalent of a stack in that it can contain an unlimited number of cards contained within an unlimited number of backgrounds. Any number of windows can be open at a time, and it is easy to communicate between windows within the same project. SuperCard supports all standard Mac window styles. You can have windows that are dialog boxes, or tool palettes, or even scrolling windows of huge dimensions. Menus ----------- Menus are a clearly defined part of SuperCard. Each menu and menuItem have a script container, and these scripts are available to any other object as if they were in the stack script of a stack. This support for menus allows a developer a nearly infinite amount of space for storing scripts, where in HyperCard, once you have used up space in the stack, background and card script, very indirect methods must be used to continue adding scripts. SuperCard also allows hierarchical or submenus for menus inserted into the menubar as a standard interface feature . Popup menus for buttons are also supported. Cursors ----------- SuperCard cursors are editable in the same way as HyperCard's (and SuperCard's) icons. Graphics ----------- Graphics (either draw or bitmap) are movable, scriptable objects just like a HyperCard button or field. Tools ----------- When selecting objects, HyperCard only lets you select a single button or field and you must have the correct tool for the operation. SuperCard supports a Pointer tool with which you can select any number of objects, of any type. In addition, both button and graphic tools support the creation of transparent polygon objects of any size or dimensions. Animation Support ---------------------- SuperCard can playback and record both PICs and STEP format animations. It also has a <move> command with which you can animate objects with this command. You can specify a path or destination or link it to the points of another graphic. How close are HyperTalk and SuperTalk? -------------------------------------- by Martin Hill <M.B.Hill@info.curtin.edu.au> SuperCard is a superset of HyperCard in terms of the language so your HyperCard experience will stand you in good stead. There are a few differences that can be annoying but generally, the extra features that SuperCard provides more than make up for it. Here's a few of the irritating differences that I've encountered: There is no clickChunk function in SC X-windows are not supported in SC so some of the more important HC XCMDs will fall over. The QTRecord XCMD is one I need desperately to show live video from a videodisc for example, but it won't work. :-( It is however, a piece of cake to create custom windows for your own purposes. There are slight differences in some commands e.g. launch instead of open, because SC uses the open command for opening windows which makes sense. Resource usage can be a pain as they are stored in the data fork in SC projects. Memory management in SC is braindead. Projects with lots of color-intensive cards choke unless SC has ridiculous amounts of RAM allocated to it. If there was a command to flush the RAM I'd be very grateful. There are other problems with SC as well, but don't get me wrong, I still prefer it over HC any day. Problems ======== Why scripts don't work. ----------------------- Simple reasons why scripts don't work: Typographical Errors --------------------------- You're typing commands (properties, functions, system messages) as two words. It's mouseUp, not mouse Up; userLevel, not user level; doMenu, not Do menu. William J. Brown-Stone, <brownw@ibm.cl.msu.edu>, says: One of my most common problems is typographical errors while writing and editing scripts. For example, there was a span of time, for months, when I regularly typed "emtpy" for "empty" and at this writing I'm on a binge of "fiel" for "file". The latter doesn't cause nearly as many scripting problems as the former, but typos eat up a lot of debugging time. The primary place that script typos cause me problems is in mistyping variable names. I tend to use lots of longVariableNames, which adds to the likelihood of making typing mistakes. And, as is the case with proofreading my own written text, I can stare at a mistyped variable name for half an hour and not see the problem. To combat this problem, I've finally resorted to doing a lot of copying and pasting variable names rather than typing them. Un-quoted Text Literals (by William J. Brown-Stone) ---------------------------------------------------------- HyperTalk is pretty forgiving when you type single-word text literals without putting them in quotes. For example, the following two command lines both accomplish the same thing: put text into theVariable put "text" into theVariable That is, unless you have a variable named "text". In which case the first command line will put the contents of the variable 'text' into theVariable and the second will put the word "text" into theVariable. Another instance when un-quoted text literals become ambiguous is when the text you type is a HyperTalk constant: put one into theVariable put "one" into theVariable The first of these will put the number 1 into theVariable and the second will put the word "one" into theVariable. While you may get along fine for a lot of script writing without putting quotes around single-word text literals, when you do introduce a program bug in this fashion, it can be a long debugging session. Having said all that, I think the best argument for always putting quotes around single-word text literals is program readability, particularly if someone else is likely to be reading your code. When I see an un-quoted text literal, my first interpretation, always, is that it is a variable name. When it is in quotes there is never any doubt. Not Enough Memory ------------------------ HyperCard has not been allocated enough memory. To check this or increase the allocation, make sure HyperCard is not open, select the application icon in the Finder, choose Get Info from the File menu and check Memory Requirements - Preferred Size. For black&white development, try 2000K. If you're working in color, you may need more. From Juan Ingles <ou90392@deere.com>: Here's an obscure one that had me going for a while. We all know that the characters "--" designate a comment. The catch is that even if the "--" is in quotes, HyperCard still considers it a comment. This code will not work: if char 1 to 2 of line 2 of Hold is "--" then next repeat instead, write: if char 1 to 2 of line 2 of Hold is "-"&"-" then next repeat My visual effect commands don't work. ------------------------------------- Your monitor is probably set for Thousands or Millions of colors. Visual effects work only at 256 colors (8 bit) or less. They also do not work when the card picture crosses more than one monitor, or when the obscure debugging command "debug pureQuickdraw true" is active. The following will also cause problems: Going between two stacks with different card sizes (or any 2 stacks prior to HyperCard 2.1) or Lock screen is in effect. With HyperCard 2.2, visual effects work at all bit depths. My userLevel won't stay at 5 (scripting). ----------------------------------------- Your changing the userLevel from within a stack but not on the Preferences card of the home stack (last card in the stack). HyperCard gets the default user level from a hidden field on that card. Selecting text from a script doesn't work. ------------------------------------------ You lose the chance to get the selection (or selectedLine, selectedField, selectedText, selectedChunk) if any of the following occurs: - a find, enterInField, enterKey, returnInField, returnKey, tabKey, or sort command executes. - the hilite or cantModify property changes (so clicking an autohilite button, loses your selection). - the lockScreen property is set to true. (This also affects the <select after text of field "foo"> command when you follow the command with <unlock screen>) - A new tool is chosen. - HyperCard moves to another card. - HyperCard redraws the card. - The Enter or Return key is pressed. The text insertion point disappears when opening. ------------------------------------------------- You have a data entry stack of some sort and you want the insertion point blinking in the first field when you open the stack or go to a certain card. The following command will accomplish this (according to the manual): select after text of fld "article" but the insertion point only flashes briefly (if <lockScreen> is false), then disappears. Why? If just about any other command is issued after the above command, the insertion point is going to go into hiding. The <select> command HAS to be the very last command issued. Use the Message Watcher to see if other commands are being issued after the <select> command. (To access the Message Watcher, type <mw> in the message box.) What does the padlock in the menubar mean? ------------------------------------------ by Cory Doctorow <Cory_Doctorow@magic-bbs.corp.apple.com> The stack is a HyperCard 1.x stack. -------------------------------------- This stack isn't really locked at all, it just needs to be converted. Select "Convert Stack" from the file menu. You might want to make a copy first. You can tell if a stack comes from an outmoded version of HC, if the CONVERT STACK menu item is not greyed-out. The stack is protected, but without a password. -------------------------------------------------- Your userlevel is way down, and "set the userlevel" commands don't work. The File menu doesn't even show a protect stack item. Argh. Hold down the command key while pulling down the File menu, and the protect stack item reappears. You can now up the userlevel or remove protection altogether. The stack is protected with a password. ----------------------------------------- You try to do the above, and get "What's the Password?" Use the Unprotect or DeProtect XCMD to remove the password protection. [I haven't had much luck with UnProtect and prefer the DeProtect stack by Ned Horvath and Allan Foster.] There are startup/openStack/openCard/openBackground handlers that reset the userlevel or disable menuItems. You can edit stack scripts from other stacks. Try this from the message box when in the Home Stack: edit the script of stack <problem stack> The stack script editor for the problem stack will appear and you can edit out any offensive lines (i.e. set the userlevel to 2). If the offensive instructions are not in the stack script, you can use the following handler to extract card, background, and stack scripts from the stack: on mouseUp answer file "Get scripts of what stack:" of type STAK put it into targetName push cd set the lockMessages to true go cd 1 of stack targetName put "Stack script"&return&return into data put the script of this stack after data repeat with x = 1 to the number of bgs go bg x put "Bg "&x&&"script"&return&return after data put the script of this bg after data end repeat repeat with x = 1 to the number of cds go cd x put "Cd "&x&&"script"&return&return after data put the script of this cd after data end repeat pop cd ask file "Save text file as:" with "Script Text" open file it write data to file it close file it end mouseUp You can now work with that text file, looking for the offending script. After you edit the file and bring the modified script into a field in HyperCard, you can use a handler such as the following to change the scripts in the offending stack: on mouseUp get fld "new script" push card set lockMessages to true go to stack "offending stack" set the script of background 1 to it pop card end mouseUp However, this won't work if the offending stack has the cantModify set to true. What does "Error XXXX" mean? Error on compacting? ------------------------------------------------- Either a card is fatally corrupted (XXXX = 5454) or you are out of memory (most other errors). Error 5454 can only be repaired by creating a new stack with all the cards except the one that bombs, then deleting the old stack. Otherwise, try allocating more memory to HyperCard in the Finder Get Info window. The Recover stack by Greg Jorgenson automates the copying process necessary to create a new stack out of a corrupted stack. An error message when compacting means there's a very good chance that the stack is corrupted. How can I script the polygon tool? ---------------------------------- From _HyperTalk 2.2: The Book_ (by Winkler-Kamins-Devoto) p. 193 You can choose the polygon tool using <choose>, but you can't draw with it using the <drag> command; you can only use the polygon tool manually. You can work around this limitation by using <drag> with the line tool to draw the sides of the desired shape, then filling it in with the bucket tool. XCMDs & XFCNs ============= What's the difference between an XCMD and an XFCN? -------------------------------------------------- [by Brian Molyneaux <BMolyneau@aol.com>] An XCMD is the equivalent of an "on" handler while an XFCN is like a "Function" handler. Once these resources are installed in your stack, you call them using the same syntax you would use for the handlers they are like. Hence, an XFCN that returned the system version and was called "SysVersion" would be called like this: put SysVersion() into x An XCMD that deleted a file and required a pathname as it's sole parameter would be called like this: deleteFile pathname An XFCN returns a value (in general) and any error is generally returned instead of the value. An XCMD on the other hand performs an action (like deleting a file) and may also return information in "the result", for example: deleteFile pathName if the result is not empty then answer "Sorry, that file could not be deleted" Where can I find an XCMD/XFCN to do such-and-such? -------------------------------------------------- Many FTP servers have directories loaded with them. A few very prolific authors have compiled all their XCMDs into collections, while others are stand-alone stacks. Some must-have collections include the Rinaldi and Dartmouth collections. The Developer Stack 1.3r comes with several externals and lots of scripting info. However, the stack has not been updated for quite a while (pre-HyperCard 2.0). How can I get Balloon Help in my stacks? ---------------------------------------- There are external commands which do this. One is included in the Rinaldi collection. There is a Balloons XFCN that comes with CompileIt!. Registered users are authorized to use the XFCN found in that stack in their own work with no additional licensing. Source code for Balloons can be found at the very end of the source code listing in the Resource Mover stack included with CompileIt!. Many CompileIt! users are not aware of this. Can I test the state of a specific pixel? ----------------------------------------- Look for an external called GetPixel or thePixel (they may both exist). thePixel is in the Developer's Stack. Be careful to give two numbers, though (horiz. & vert.) or your Mac may crash. [I could not find either of these externals at the University of Michigan archive (umich). Does anyone have an ftp site or an alternative?] How can I create a custom palette? ---------------------------------- [William J. Brown-Stone (aka Bill Brown) <brownw@ibm.cl.msu.edu>] Palette Maker in the Power Tools stack: The Power Tools stack that is distributed with the full version of HyperCard has a Palette Maker card. There is a Light Bulb button on the card that provides documentation. With that and a bit of reading between the lines and some experimentation, it's fairly easy to create your own palettes. In a nutshell, to create a palette: 1. You place artwork that will give the palette it visual appearance (including what the buttons will look like) in the card layer of the Palette Maker card. The artwork can include text. 2. You overlay the artwork with transparent buttons that let the artwork show through and that define the size of each button you want to have active on the palette. 3. You define a one-word script for each button. This word is the name of a handler that will be in the background or stack scripts of the stack where the palette will be used. When you click on a button in the palette, that handler name is sent as a message into the HyperCard message hierarchy and the handler in your stack traps the message and carries out the script in the handler. The buttons in Palette Maker palettes respond only to mouseUp. Once you have the palette defined in this way on the Palette Maker card, you use a button on the card to have the palette installed in the stack of your choice. Actually a set of resources along with an XCMD is installed in the resource fork of your stack. You show and hide the palette using HyperTalk's 'palette' command. Once the palette is installed in your stack it is a relatively static entity. The only thing that changes about it are the hilites of the buttons when you click them. You can't modify the palette definition in any way from your stack. However, the Palette Maker facility allows you to create new Palette Maker cards in the Power Tools stack and your palette definition is kept on that card in the Power Tools stack. This means you can go back to the card and make changes to the palette and reinstall it in your stack. Chiclette, a maker of dynamic palettes ----------------------------------------- The only other palette making facility I've used is Chiclette. You use the Chiclette stack (available via anonymous ftp from many fine ftp sites) to define the artwork and buttons for you palette in a somewhat similar fashion to that described for Palette Maker above, but you can go much farther and do much more with Chiclette, and end up with a more flexible palette that you can modify under in your own stack, including modifications made from executing handlers. The price you pay for this extended capability and flexibility is an acute and lofty learning curve. To be fair, if you limit yourself to creating a fairly static palette definition, with buttons that respond only to mouseUp, use just the Chiclette stack to define and install it in your stack and don't tamper with the palette definition in your stack, what you need to know is not that much greater than for Palette Maker. If you have more sophisticated needs for functionality in your palettes (and the tenacity to ride the curve) the rewards can be worth the effort. The documentation that comes with the stack is medium-good plus a little, but there is a lot between the lines and that is backed up by assumptions about what you already know. On the up-side, the e-mail address of Chiclette's author is included in the stack and I've found him responsive. Chiclette's use is free in non-commercial stacks. In the space that is reasonable to use here, it is difficult to do justice to Chiclette's features. I'll see how brief I can make it. 1. Both Chiclette and Palette Maker install XCMDs into your stack. And, whereas Palette Maker installs static resources to define the palette, Chiclette installs a scripted button in your stack. This button contains the Chiclette commands that define and activate the palette. You can modify the script of that button to change the definition of the palette after it is installed in your stack. You can also move that script out of the button into other handlers. 2. The Chiclette commands that define the palette generally and the buttons in the palette work by setting characteristics and properties of the palette and the buttons. After the palette has been defined and while it is active on the screen, it is possible to change the properties, on the fly from any executing handler. You can not only set the properties but you can also get the properties. Allowing you to make decisions about changing the definition of the palette or about general script execution based on that information. 3. Chiclette buttons have many of the same properties that standard HyperCard buttons have: Name, Rectangle, Location, Icon, ShowName, AutoHilite, Hilite, Visible, Style, TextFont, TextSize, TextStyle. In addition there are properties of GrayedOut and Disable that allow you to make a button inactive and display it as such. 4. The fact that buttons can have names and the names can be changed and displayed on the fly, enables you to simulate having changeable text fields on the palettes. 5. Palette Maker buttons are limited to responding to mouseUp events only. Chiclette buttons can respond to mouseUp, mouseDown, mouseStillDown, mouseEnter, mouseWithin and mouseLeave. Much more can be said, but that should give you enough perspective to allow you to extrapolate the general range of possibilities. With all that hype, let me emphasize once more that when you start pushing Chiclette palettes to the edge of the envelope you are in for a good deal of frustration and will need a tenacious power-tongue to lick the stamps. A full discussion of the idiosyncrasies of debugging scripts connected with Chiclette palettes is definitely not contained in the Chiclette documentation and is in itself worthy of a fairly lengthy discussion; you get a few clues and then you have to write your own book. Still, in my estimation, the effort was worth it. And will be again when, after a long period of not working with Chiclette, I have to go back and learn it all again. Chiclette Info --------------------- The external command "Chiclette" has been written by Jean- Marc Astesana. The use of this stack and of the XCMD Chiclette (release 1.0) is free in any non-commercial product. All rights are reserved. (c)1991 hyperSOLutions. hyperSOLutions 170, rue de Lourmel 75015 PARIS FRANCE PhoneJ: J(33)J(1)J40J59J98J86 FaxJ: JJJ(33)J(1)J45J78J64J58 AppleLink: HYPERSOL Palette TIP ----------- by Juan Ingles <ou90392@deere.com> Palettes can be in color. Create a PICT resource with your favorite Paint/Draw program. [see "How do I create a PICT resource?"] Open your stack with ResEdit, and find the PICT resource for your palette. (You did remember ResEdit Rule #1 -- Always work on a copy -- didn't you?) Write the id number of the resource down. Delete that PICT. Paste in your new color PICT and "get info" for it. Change the resource ID number to the number that you wrote down. Quit ResEdit, saving changes, and enjoy! Admin ===== Acknowledgments --------------- Many are they who have contributed to this FAQ and I thank you all. A few are mentioned in the articles. Special thanks to the following: Dave Lorand <davel@earlham.edu>,ex FAQ Archivist. Dave posted the FAQ to comp.sys.mac.hypercard and archived it at ftp.earlham.edu. Dave has the distinction of posting the first HC FAQ. He beat me by a few days. Bruce Carter and John Pinto for some of the early data collection that got the FAQ going. John has a text version of the FAQ on the web. Brian Molyneux for version data and info on Royal Software products. Editing and proofing: Bill Brown, Bruce Carter, Bill Karle Book List: Originally compiled by Asif Taiyabi HyperCard 2.2 Review: Paul Foraker Peter Brigham for taking the FAQ and making it a stack and getting it done really fast after a text release. The stack is available on my AOL ftp site (or will be RSN). ftp://members.aol.com/petefleck/ The following list submitted answers or suggestions that were helpful in the FAQ preparation. Jay Cross Dave Blackburn Cory Doctorow Geoff Duncan Jacque Gay Mark G. Gillingham Christopher J. Henrich Scott Raney Jeffrey D. Wurtz Who's Peter Fleck? ------------------ He is president of PF Hyper, a Mac consulting company that uses HyperCard (and Director and SuperCard) for making training programs and interactive multimedia for both the Mac and Windows. Check out his web page at <http://members.aol.com/pfhyper/>.