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.