Bol Processor BP2 -- a 'QuickStart' 8.	Scripts 9.	Make it swing with smooth time... Title Page Index Contents

8. Scripts

Scripts have been briefly introduced in §1.3. A script is a sequence of instructions that may be executed to replace manual operations on BP2. AppleScript and HyperTalk are good examples of script languages used by the Macintosh®. Most recent software environments are scriptable, some even are accessible from AppleScript.

The only link between BP2 scripts and the Mac operating system is through BP2 script files (or their aliases). In other words, if AppleScript sends a double-click to a BP2 script, then BP2 will automatically be launched and the script will be executed. However, AppleScript will loose the control until the script has been entirely executed and the "Quit" instruction has been found. The script could for instance load some data and/or grammars, produce musical items, print windows, etc., and then return to AppleScript. See for instance "+sc.checkAll" which is used to verify most functions of BP2.

A later version of BP2 might be "scriptable", i.e. operated step by step from AppleScript.

(Prefix "+sc" was chosen instead of "-sc" to avoid confusion with "-se".)

Unlike AppleScript and HyperTalk, the current version of BP2 script language does not accept variables and has no conditional branching ('if', 'repeat'...).

BP2 executes scripts in two ways: either it reads them in the "Script" window, or it reads them directly from disk. In the first case, the current instruction is hilited in the "Script" window, in the second case it appears in the "Message" window (the bottom line of the screen). Execution may also be done step by step.

Script instructions are listed in the "Script" menu.

Although the script language comprises already 161 instructions, it is still under development. Priority has been given to automating music performance, rather than edit procedures.

8.1 Checking a script

Before executing a script for the first time it is recommended to select "Check current script" in the "Script" window. This debugging tool does not only checks script syntax. It also checks that all files loaded by the script are accessible. If another script is called by the current script, it is loaded and in turn checked. The debugger also makes sure that the same script will not be called twice during the current script's execution (thus avoiding recursive calls). If a file is not found, the script debugger prompts the user to locate it. Then it may rename the file or keep trace of its location by inserting instructions like "Set directory..." or "Set Vref...". Understandably, it is necessary to call "Check current script" every time once of the files used by the script has been renamed or relocated.

8.2 Scripts, volumes and folders

Although BP2 scripts can load files from different folders, and even from remote disks, it is recommendable to keep all concerned files in single project folder. An excellent method is to keep files where they are and to place their aliases into the project folder, as shown Fig.10.

At execution time, BP2 does its best to identify folder(s) in which the files required by the script will be found. For example, if a grammar file has been loaded from a specific folder, then other grammar files will be searched in that same folder. In addition, the folder in which the current script is saved will be searched. Instruction "Set directory..." will provide the path to a specific folder.

Instruction "Set Vref..." is less practical because the value of Vref depends on the volumes currently opened. If a script contains "Set Vref..." it may not execute properly if you start your computer in a different configuration, e.g. the Syquest unit or the scanner is not switched on. If the script debugger generates a "Set Vref..." instruction it is therefore recommendable to delete it and locate the file (or an alias of it) on the same volume as the script.


Bol Processor BP2 -- a 'QuickStart' 8.	Scripts 9.	Make it swing with smooth time... Title Page Index Contents