Debug

Controls the debug mode.

Syntax:

Debug ( mode [, init-string] )

Parameters:

(i) mode: @ON or @OFF

(s) init-string: [optional] the string placed in the edit field of the debug dialog when the dialog is initialized.

Returns:

(i) previous debug mode

 

Use this function to turn the debug mode on or off. The default is @OFF.

When debug mode is on, the WIL Interpreter will display the statement just executed, its result (if any), any error conditions, and the next statement to execute.

Note: To debug into a 'called' WinBatch script or User Defined Function, make sure to add the corresponding debug command, to the 'called script' or user defined function.

The statements are displayed in a special dialog box which gives the user four options: Next, Run, Cancel and Show Var.

 

Next executes the next statement and remains in debug mode.

Run exits debug mode and runs the rest of the program normally.

Cancel terminates the current WIL program.

Show Var displays the contents of a variable whose name the user entered in the edit box.

 

Example:


Debug(@ON)
a = 6
q = AskYesNo("Testing Debug Mode", "Is the Pope Catholic")
Debug(@OFF)
b = a + 4

produces:

wila-k11_shg.gif

... Then, If the user presses Next:

wila-k12_shg.gif

... and presses Next again:

wila-k13_shg.gif

... and Then presses YES: etc. (If the user had pressed NO it would have said "VALUE=>0".)

wila-k14_shg.gif

 
See Also:

ErrorMode, DebugData, DebugTrace, LastError