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:
- Choose Scripts Command Line. The input box appears.
- 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.
- 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.
- Press Done when you are finished entering commands in the input box.
- Verify that all features work as advertised.
- Verify that the drop-down list reflects recent commands. The capacity of the list is 30
commands. Duplicate commands are eliminated (so that if you enter Record Next ten times,
only one appears in the list).
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:
- Choose Scripts Command Line to bring up the CAL input box.
- Enter the new command STEP ON. This specifies that any subsequent script
file will execute in single step mode.
- Execute a script by choosing one from the Scripts menu or entering a CALL command
in the input box.
- 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.
- Press ESC to stop executing the script.
- Enter the command STEP OFF to disable single step mode.
- Non-executable commands, such as labels or comments, are not included in single
- 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.
- 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.
- Try some of the ChemFinder test scripts in single-step mode.
- Verify that ESC terminate a stepped script correctly.
- Verify that a STEP ON command within a script will switch into single step mode at the
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:
- Open a form containing a subform, such as CS_DEMO.
- Make sure Form Layout tools are on display. Right-click on the header of the subform to
bring up the Subform Properties dialog:
- 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.
- Click OK to dismiss the dialog.
- 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.
- Click any line in the table. The selected script will execute automatically.
- Attach scripts to subtables and verify correct action.
- This feature will be incorporated in the next version of ChemACX. When that application
becomes available, verify that clicking a highlighted item takes a sensible action.
- Try connecting a subtable to a faulty script. Make sure script generates error and
- Verify that script selection is preserved on saving and restoring form.
The former command NONINTERACTIVE has been changed to INTERACTIVE ON | OFF. In
the command input box or within a script, the command INTERACTIVE OFF disables further
user interaction; INTERACTIVE ON reenables default behavior.
The new command STEP ON | OFF is described above.
The OPENDB command now takes arguments specifying the mode of database opening.
Format of the command is now:
OPENDB [R | E] database-name
where R means open the database read-only, E means open it for exclusive use, RE
means read-only and exclusive, and if the argument is omitted, open normally (for reading
- The DOS command can now be entered without arguments to bring up an interactive
command prompt window.
Script Bug Fixes
Previously it was not possible to carry out more than one loop in a script. This is now
The ESC key now terminates a script or called script immediately. Exception: ESC to remove an error alert will bring up another alert
asking if you wish to continue the script.
The IF command now handles arguments more naturally. For example, to see if a variable
has a null value, you can now use the syntax:
- Run the test scripts, as described elsewhere.
- Try interrupting scripts. Press ESC while script is running; script should terminate
immediately. Press ESC at any message box or error alert and you
should be asked whether or not to continue the script.
||get value from <section, item> of ini file
||on: editing affects form boxes; off: box contents
||turn single-step mode on or off
||turn interactive mode on or off
||launches moving arrow
||show message for n seconds max
||play specified .wav file
||sort on specified field. D=descending.
||increment variable (must have numeric value)
||decrement variable (must have numeric value)
||create framed box
||alert asks if user wants to continue (yes/no)
||<name> [typ] [wid]
||create field; see Notes for types
||delete field from current table
||create empty table with ID field
||delete table from current database
||scale coords and fonts by factor
||get system metric into variable
||select table for subsequent field actions
||<v> <v op v>
||perform mathematical operations
||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:
Variables and Concatenation
- When setting a variable, you can use
setvar <no variable>
... set var 1
set var i
setvar Vi [or vi]
... set var i
- When substituting a variable, use "$" to
mean "contents of," followed by variable name (vi or Vi) or system variable.
Trailing $ is optional unless variable is being concatenated. Examples:
msg $v1$and text