Debugging scripts with the WinStudio script editor

To debug using the WinStudio Script Editor, WinStudio must be configured to use the built-in script editor. These settings are made in User Preferences, on the Design Time tab.

The procedures described in this topic apply to form scripts, but the main steps apply equally to global scripts.

To debug a script using the WinStudio Script Editor:

  1. Open a form and go into Design Mode.
  2. From the Edit menu, select Script Editor .

    The script editor displays any form scripts that already exist for the form .If no form scripts exist, the script editor displays a template script.

    For more information, see About the WinStudio Script Editor.

  3. Add or edit the code for your script.

    If you make errors in the script, the script editor provides two visual cues:

    • Squiggly red underlining displays beneath text where errors exist.

      To view a tooltip that describes the reason for an error, use the pointer to hover over the location in the script that has this squiggly red line.

    • The Error List tab in the bottom left corner of the script editor displays the number of errors that currently exist, in parentheses ().

      To view the list, click the Error List tab.

      To see the location of a particular error, double-click that error in the list. The cursor (and focus) then jumps to the text in the code that is causing that error.

  4. For more information about the tools and options in the editor that you can use to help write the code, see About the WinStudio Script Editor.
  5. Optionally, to compile the code for debugging purposes, select the Compile for Debug option.
    注意: To actually debug the script when you are ready, select Debug from the Script menu.
  6. Optionally, to have the editor automatically compile the code when closing and returning to the form, select the Compile source on OK option.

    With this option selected (which it is by default), you cannot close the WinStudio script editor until all build errors have been resolved. So, if you have errors you know about in your code, but you still want to close the editor (saving the code with errors and all, for later resolution), you must clear the Compile source on OK option before you click OK.

  7. To save the script and return to the host form, click OK.
  8. If the build fails, optionally, use the Output tab in the bottom left corner of the script editor to analyze and identify any causes for the failure.
相关主题