Using the Watch Window

AutoCAD AutoLISP & Visual LISP

 
Using the Watch Window
 
 
 

The Watch window monitors the values of AutoLISP variables during program execution. Each Watch window element line displays the name of a variable and its current value, as illustrated in the following figure:

The Watch window is updated at each step of a VLISP interactive session and always shows the current environment state. In debugger mode, the Watch window is refreshed automatically at the end of every expression evaluation.

To add variables to the Watch window

  1. Highlight the variable name in any VLISP context (that is, in a text editor window, the Console window, etc.).
  2. Choose the Add Watch button, or choose Add Watch from the Debug menu. You can also select Add Watch from a shortcut menu by right-clicking the mouse while the cursor is on a variable name.

  3. If the Watch window is already active, you can add variables to the watch list by clicking the Add Watch button on the toolbar in the Watch window.

    If VLISP cannot determine which variable you are interested in based on the cursor position or the text you've selected, it displays the Add Watch window:

    Specify the name of the variable to be watched in this window, then click OK.

The Watch window retains its variables during a VLISP session. This means that if you invoke Watch, add variables to the Watch window, and then close the Watch window, the variables you added will appear in the Watch window, if you invoke Watch again during the current session.

The introductory section of this chapter includes an example of using the Watch window. (See Monitoring the Evaluation Results of an Expression.)