Home
|
Macrobyte Resources
Tonto Documentation
Registering a ScriptScripts are registered with Tonto through an AppleEvent, but you don't have to worry about that. Just send the script (as a string) to suites.Tonto.registerScript. registerScript( ) takes four parameters.
Example: Registering a List of ScriptsTo register a group of scripts all at one time (which is much faster than registering them all separately), you'll use two verbs. The main verb is tonto.registerList(), which takes one parameter: a list of records, in which each record describes a single script to be registered. The records that must be provided as items in the list (sent to registerList) can easily be created by using utils.getRecord( ) takes four parameters which are identical to those sent to tonto.registerScript
Example: Removing a Script (unregistering)
The easiest way to remove a script button from the pallette is simply to command- click on the button. It will be removed instantly. To allow you to automate the removal of buttons (i.e. to unregister scripts), an Apple Event has ben provided. To unregister a script from Frontier, call tonto.unregisterScript( ) with two parameters: the caption or index of the button you'd like removed, and the name of the set from whnich it should be removed. Example: Working With SetsSets are groups of scripts, associated with a specific application. The name of a set must be four characters long, and is the creator code (signature) of the associated application. The buttons for the scripts in a set will only be visible when the associated application is frontmost. There is also a global set, named, appropriately, "global". If no set is specified when you call tonto.registerScript(), then the script will be added to the global set. All of the buttons for the global set are always visible. You can have any number of script sets. At this time, a script set can only contain 10 scripts (10 buttons). Adding IconsYou can add your own set of icons to Tonto, without changing the Tonto application. We've included a file called "Tonto Icons". Make sure that it's in the same folder as the Tonto application file. Any cicn resources in that file are automatically available for use on the buttons, and they can be specified by name or by id number. It is strongly recommended that you only use icons which are 16 x 16 pixels. Caching Scripts
Most likely, you'll want to register the same scripts every time. As of Tonto 1.0a4, the scripts are cached in menubar objects, in user.tonto. See tonto.#sampleCache for an example. All that you need to remember, to use the caching mechanism, are the following points:
The benefits of this caching mechanism are two:
|
|
Site last updated Tuesday, August 17, 1999 Contact Macrobyte Resources with comments or questions. Broken links, or other problems with the site? Please write to the Webmaster. |