2.2 Using the Script Debugger

The Operations Center Script Debugger can be used to develop and test scripts. This section describes accessing the Operations Center Script Debugger from the Scripts tab as a continuation from the previous steps in Section 2.1, Adding a Script to the Script Library. See Section 2.3, Additional Options for Running the Script Debugger for other ways to access the debugger.

Figure 2-1 The Debugger Window Showing Three Commands on the Evaluate Tab

Script code displays in the debugger with numbered lines for identification and navigation.

Table 2-1 provides an overview and description of debugger features.

Table 2-1 Debugger Features

Debugger Feature

Description

Variable Display

Shows all the variables that are “in scope” for the current object. Even if your script declares local variables by using the var keyword, the debugger displays them as global variables if they are declared at the global scope. There is no way to declare a local variable at the global scope.

Evaluate Tab

Type a command to execute and evaluate. Figure 2-1 shows how three variables were executed by the user: a URL, user account, and password.

The following topics cover debugging scripts using the debugger:

2.2.1 Debugging a Script Using the Debugger

To debug a script using the debugger:

  1. From the Scripts tab, select Debugger.

    The Debugger opens and displays the script.

  2. When a script loads, select to step through the script code using one of the following toolbar buttons:

    Step Into: If the current line of execution involves a function invocation, traces the invocation into that function.

    Step Over: If the current line of execution involves a function invocation, traces the invocation over that function, returning execution control to the Debugger after that function has completed.

    Step Out: If the current line of execution is inside a function invocation, traces the invocation out that function, after it has completed.

  3. To set a breakpoint to pause the script, click the left margin on the desired line of code.

    A breakpoint symbol displays.

  4. Click again to remove the breakpoint.

  5. Click the Go button to evaluate the script.

    The Operations Center Script Debugger evaluates the script syntax and errors display in a dialog box.

  6. Click File > Exit to close the debugger.

2.2.2 Automatically Running Debugger Scripts

To run the debugger automatically for a specific script or to open the debugger for all scripts at runtime, click the Options menu from the Debugger console and select one of the following options:

  • Never: Sets the debugger to never open automatically when a script runs.

  • All Scripts: Automatically opens the debugger for every script at runtime.

  • Prompt on Each Script: Prompts to open the debugger for every script at runtime.

  • Specific Script: Opens the Debugger only for the specified scripts.