How to start and debug script files

Top  Previous  Next

Starting scripts

Scripts can be started and restarted in several ways. The easiest one uses the commands of the Script Files dialog:

to start a new script enter the file name into Start new script file box and click the Start button in the bottom part of the dialog box;

to restart a stopped script highlight its name in the dialog window that displays all the loaded scripts and click the Restart button.

A script can be also started by means of the StartCommandFile() function executed by another running script.

Debugging scripts

A script can be started for an immediate execution (read above) and can be launched in the Debug mode that usually is necessary while you master the script and need to check if it properly works and make necessary corrections in it. To start the script debugging highlight its name in the Script Files dialog window and click the Debug button - the program opens the window with the script file's editable text. The window is split in two panes: the left pane displays the script text, the right one is the AutoWatches pane. If you check the Debug box then every time when you start a script it will automatically switch to the Debug mode, stop the script execution and open the window with the script file.
 
Scripts_files_debug

 
Syntax constructions and the lines, which correspond to the current PC value (blue strip) and the breakpoints (red strips), are highlighted in the script file text (for more information, see Syntax Highlighting).

Local menu and toolbar

The local menu window contains the following commands, most of which are duplicated by the corresponding buttons on the window toolbar:

 

Command

Window Toolbar

Description

Step

Step

Executes one operator of the script.

 

Run

Run

Starts continuous execution of the script in the window. Then the script execution can be broken either by hitting a set breakpoint or by the command Stop.
 

Run to Cursor

 

Executes the script up to the line where the caret is positioned (the corresponding address). Alternatively, you can double-click the line to carry out this command.
 

 

Stop

Stops the running script.
 

Origin

Origin

Displays the source text from the line whose address corresponds to the script file Program Counter. This operation is not available when source text lines do not exist for the program addresses.
 

New PC

New PC

Sets the script file’s Program Counter value to the address corresponding to the line where the caret is positioned.
 

Toggle Breakpoint

Break

Sets up or clears the breakpoint at the address corresponding to the line where the caret is positioned. When you execute the Run or Run to cursor command the program execution will be stopped at the breakpoint.
 

Add to Watches Window

+Watch

Opens the Watches window (if not yet opened) and places the name at the caret position into it.
 

Restart

Restart

Restarts the highlighted script.

 

Note. To get help on a function or variable, point to the function or variable with the cursor and click. For more information, see How to Debug a Script File and Script Files.

For customizing the ChipProg user interface and debugging purposes scripts themselves can open two types of additional windows: the User window and the I/O Stream window.