Sample Scripts Stack
Scripts written in several different OSA languages
Contents

Software

Adminalyser

Reference Maker

Licenses Stack

File Sync

License

USB2Serial Chat

Links

Port Chooser

DIFfersifier 3.0

Zipfer

Salery Web Shop

Quibble Archives Browser

Bugs in the Quibble
Archives Browser


Sample Scripts Stack

Chat Rev 1.2M

CheckPDF 1.0

Create New Stack 1.1

Curvator

Bugs Log 1.0

Country Codes 1.1.1

Noughts and Crosses

XFCNs and XCMDs

More downloads

Sample Scripts Stack

Sample Scripts Stack 1.0
CopyrightŠ2003-2004 by Mark Schonewille
Nijmegen, the Netherlands
http://schonewille.cjb.net



Introduction

After many years of scripting with HyperTalk, AppleScript and a few other languages, I had collected more than 150 files with script snippets, tips, and my own experiments. In other words, if I wanted to know how to do a trick or how to use a particular OSA tool, I couldn't find it in the mess of files. That was the reason to create this stack. It contains all the information from those 150 files. Some of the scripts are real trash, others are fabulous tricks. There are also a few articles and complete AppleScript programmes, for instance.


The Sample Scripts stack also contains the 30 scripts from Stan Soria's Script Library. Click the Import button on top of this card to import the scripts from that stack, if you have added your own scripts to that Script Library --okay then, I'll add a few features to have the two stacks co-operate.


How to use this stack

Reading — To read the field where you find the scripts, click the little triangle on top of this card. If the triangle points to the left, this field will be enlarged. To reduce the size of the field, click the little triangle again. You may want to see the script in the script window, to have a good overview of the entire script, or to play with it. Click the Show Card Script button on the left to open the card script. If you want to copy a script, click the clipboard icon, also on top of this card, to copy the script to the clipboard.

Navigating — Navigate through this stack using the Index button on the left, the Home button on top of this card, and the arrow buttons on the lower left. Most buttons are evident. The Index dialog has a few hidden features. Use the arrow keys to select previous or next lines in the list. You can also type the first character of the name of an item. E.g., type a "J" and the item "JavaScript Example" is selected. Type command-period or escape to cancel the dialog, return to select. If you think that the Index has become a mess somehow, press the Optionkey while clicking the Index button. This will rebuild the index.

Printing — Click the small printer symbol on top of this card to print either the script field or the description field. It will be sent to the printer directly.

Export — You can export the descriptions and scripts in this stack to each of the formats stack, html, rtf, text and wiki. Click the export button (outgoing arrow) and the Format dialog window as shown below will appear.






If you want to export all cards in this stack, uncheck the checkbox saying This card only... Choose a format and click Okay or press the enterkey. If you are saving the current card only, you will be asked for a filename. Otherwise, you have to select a folder to store the files.


Executing scripts

Handlers field — The field on the bottom-left contains the handlers that are found in the script field on the right. Double-clicking a handler in this field will execute it. This will happen correctly -most of the time-- if the script is a HyperTalk, AppleScript, UserTalk, or JavaScript script.

I don't have good Perl and QuicKeys examples, that is why I haven't been able to make the handler-recognising function recognise Perl and QuicKeys handlers, yet.

If there is an idle, openCard or closeCard handler in the script field, the scripts will be executed accordingly, after you press the Update Cd Script button. Once you've done that, you can also call handlers from the message box.

Functions often contain scripts such as

function someFunction someParam
  -- some stuff
  return newParam
end someFunction

on doSomeFunction
  get someFunction("Some Param")
  return it
end doSomeFunction

This is not a very elegant solution, but in this way both handlers will be available in the handlers field and the function can be executed with parameters by double-clicking it in the handlers field.

Card specific buttons — Some sample scripts are included in additional buttons on the card. They may call handlers in the card script or contain completely independent scripts.

Use Clipboard — The result of a handler (either or ) is usually put into the message box, if it is not empty. For very large results, you can use the clipboard. By checking the Use Clipboard button, the Sample Script stack will put the result of any sample script into the clipboard, rather than the message box. Go to SimpleText and paste the clipboard in the new file to see the results.


Adding your own scripts

Adding scripts — To add your own script to this stack, first unlock the fields by clicking the Lock button on top of this card. Then paste your script into the Script field. It is best to use non-default handlers only, such as

on myHandler
  --do some stuff
end myHandler

rather than default messages such as openCard, closeCard, openBackground, et cetera. Also, note that AppleScipt applets often contain a command, which should be commented out to prevent HyperCard from quitting. For functions, use an additional script that call the funtion, as decribed in the previous section. You can add card buttons as you wish. Note that non-transparent buttons colourised gray. If you want to make a b&w-only button, make it transparent with an icon.

Choose OSA language — When you paste your own script into this field and you want SampleScripts to recognise the handlers, you should choose the appropriate OSA language in the pop-up menu on the top-right of this card. If you don't do this, this menu will flash red every time you access your new card. That's why it also flashes upon creating a new card: Sample Scripts doesn't know which OSA language you're going to use.

Submitting scripts — Once you have added your own script to this stack, click the Export button (next to the print symbol) to create a new stack with the current card.If you want you can delete all resources from that new stack, using ResEdit. Compress the news stack with StuffIt!, Compact Pro, or ZipIt! and send it to europe@ehug.info. You script will be added to the next version of the Sample Scripts stack.

Importing from Script Library — To import your own scripts from from Stan
Soria's Script Library, click the Import button on top of this card, next to
the expoprt button. If prompted for, select the Script Library stack. After
you do this, the import button will disappear.


Credits

The scripts in this stack come from many different sources. If the original author is known, the name of the author is included in the comments to the script. Besides all the contributing authors, I would like to thank Geoff Johnson-Brett for valuable comments.


More information

For more information, send your questions to the author of this stack. Contact information is included in the downloadable file. You can also ask your questions at the HyperCard Mail List. For information about this List, select HC Mail List Infro from the index.

One last remark: the calendar page icon is just an icon and nothing more. It doesn't contain any data.


Download

Download Sample Scripts Stack. You need StuffIt expander to decompress the file.


License Conditions

In the text below, stacks refers to Sample Scripts Stack 1.0 and the accompanying components. Author refers to Mark Schonewille, product is defined as any medium that may contain Overload. Other terms are defined by international agreements, directions of the European Union or Dutch national laws. A number of terms are defined by custom law.

Sample Scripts Stack 1.0 are copyright protected stacks. The stacks and all other components of this software package cannot be sold as a separate software package and cannot be part of any commercial product, such as magazines, shareware collections on cd-rom and the internet, books and promotional artefacts, without a written permit of the author. This restriction also holds if the product is a free gift. Sample Scripts Stack 1.0 may be freely distributed in unaltered form, as long as the above restriction is not violated. This means that Sample Scripts Stack 1.0 is freeware, but the property rights remain with the author. The author is eligible to request the removal of the stack from hard disks and computers and the destruction of any product that contains the application.

The author and the persons who are mentioned anywhere in the stacks or documentation are not responsible for any damage that is possibly, allegedly or actually a consequence of the use of the stacks.

IMPORTANT: even though Sample Scripts Stack 1.0 may be distributed freely for non-commercial purposes, the copyrights still apply to the stacks as well as separate parts of it. Some parts of Sample Scripts Stack 1.0 may be copyrighted by Apple Computer.


Last update: 02-06-2005