Debugging a macro


When a macro didn't go according to plan, you need to determine what exactly causes the macro to fail. The Script Editor provides the debugging feature allows you to observe and correct the errors in a macro. To activate the debugging feature, you just play the macro in Script Editor.

Running Macro in Debug Mode

To debug the macro, you should launch the macro in the debug mode. You just open the macro in Script Editor, then select the menu Play, next select Play, or press F5. In the debug mode, you can see the playback on the Play Log pane.

Setting Breakpoints

A breakpoint pauses the macro execution immediately before the breakpoint line. Breakpoints can be set whether the macro is running or not. Once a breakpoint is set, the breakpoint icon will appear next to the line number of the step. To set a breakpoint, do the following:

  1. Go to the line want to set the breakpoint.
  2. Press the key F9, or click the menu Play, then select the Toggle Breakpoint.

Controlling Execution

Breakpoints are used to pause macro execution in order to give you a chance to inspect the state of the action at that point. When execution stops at a breakpoint, you can control execution by using any of the following on the menu Play or toolbar.

  • Continue

    Continue to play the macro without pausing, until another breakpoint is encountered.
  • Step

    Continue to the next line of macro in the current method, and then pauses.
  • Reset

    Stop the execution.
  • Break

    Pause the running macro.

  • Inspecting Variables

  • Local variables and global variables can be inspected through the User Variables pane and Global Variables pane. To inspect variables:

    1. Set breakpoint(s)
    2. Play macro in debugging mode, or break (pause) the running macro.

    During execution, the debugger will pause at the line with the breakpoint. Once execution is paused, variables in User Variables pane and Global Variables pane can then be inspected.