Script Features

… more customizable automation

In developing ChemFinder 5, we made extensive use of ChemFinder Automation Language (CAL) to create testing scripts. In the process, we developed some new CAL features.

Updated 16 Jun 98 for Alpha2
Updated 09 Oct 98 for Beta1

New Command Input Box

CAL now has its own custom input dialog box, for added convenience in entering commands. The dialog is modeless, so that it need not be closed when interacting with the program. To save typing, it features a drop-down list of recently-used commands.

To use the new command input box:

  1. Choose Scripts Command Line. The input box appears.
  2. Enter a CAL command in the box, or use the drop-down list to retrieve a recently-used command. Press Execute to execute the command.
  3. Press Help to bring up the CAL help window. Because the input dialog is now modeless, you can scroll the help window, or copy commands from it and paste them into the input box, without closing the input box window.
  4. Press Done when you are finished entering commands in the input box.

Testing Suggestions

Single Step Mode

For debugging purposes, ChemFinder 5 features a single-step mode of operating CAL. You can step through a script one step at a time, watching each command execute.

To enable single step mode:

  1. Choose Scripts Command Line to bring up the CAL input box.
  2. Enter the new command STEP ON. This specifies that any subsequent script file will execute in single step mode.
  3. Execute a script by choosing one from the Scripts menu or entering a CALL command in the input box.
  4. As each executable step in the script is encountered, its text is shown on the status line. Press any key except ESC to execute the command and proceed to the next.
  5. Press ESC to stop executing the script.
  6. Enter the command STEP OFF to disable single step mode.


  1. Non-executable commands, such as labels or comments, are not included in single stepping.
  2. The STEP ON/OFF command may be entered directly into a script. When the script reaches the command, single step mode will be turned on or off.
  3. The command echoed in the status bar has already been translated, i.e., substitutable arguments have had actual values inserted before the command is displayed.

Testing Suggestions

Script on Subtable

In ChemFinder 5, it is possible to specify a CAL script to be automatically executed when the user clicks an item in a subform in table view. This allows a subform to serve as a sort of list selection box. Typically such a script would use CAL commands to retrieve the clicked item, then take some action based on it, such as call up another form displaying further information on the clicked item.

To attach a script to a subtable:

  1. Open a form containing a subform, such as CS_DEMO.
  2. Make sure Form Layout tools are on display. Right-click on the header of the subform to bring up the Subform Properties dialog:
  3. In the Table Script box, enter the name of a CAL script, or use the button to the right of the box to bring up a file open dialog.
  4. Click OK to dismiss the dialog.
  5. If the subform is not already in table view, double click within it to change to table view. Entries in the table will now be underlined and colored blue, to give the appearance of a clickable link on each line.
  6. Click any line in the table. The selected script will execute automatically.

Testing Suggestions

Command Changes

Script Bug Fixes

Testing Suggestions

New Commands

Get   [v] <sec,itm>   get value from <section, item> of ini file
FormEdit   [ON|OFF]   on: editing affects form boxes; off: box contents
Step   [ON|OFF]   turn single-step mode on or off
Interactive   [ON|OFF]   turn interactive mode on or off
ArrowBox   [rect]   launches moving arrow
TimedMsg   [n] <msg>   show message for n seconds max
Sound   <filename>   play specified .wav file
Sort   [D] <box>   sort on specified field. D=descending.
Increment   [v]   increment variable (must have numeric value)
Decrement   [v]   decrement variable (must have numeric value)
FramedBox   <rect>[fld] [label]   create framed box
Continue   <text>   alert asks if user wants to continue (yes/no)
CreField   <name> [typ] [wid]   create field; see Notes for types
DelField   <name>   delete field from current table
CreTable   <name>   create empty table with ID field
DelTable   <name>   delete table from current database
Scale   <percent>   scale coords and fonts by factor
Sysmetric   <index> [v]   get system metric into variable
SelTable   <name>   select table for subsequent field actions
Let   <v> <v op v>   perform mathematical operations
ScaleToFit   <string>   scale all elements in form such that <string> fits in window

New Help Window

The CAL Help Window is called up from the command "HELP" or by pressing the Help button on the command input box.  The new windows contains three sections: one for commands, one for variables, one for notes.  The top two have adjustable columns:

wpe1.jpg (37003 bytes)

Variables and Concatenation

setvar <no variable>     ... set var 1
setvar i                 ... set var i
setvar Vi [or vi]        ... set var i
msg $v1
msg $v1$
msg $v1$and text
msg $system_dir
msg $system_dir$\filename