Debugging VBScript

The Visual Studio programmer has the convenience of a debugger built into that development tool but beyond the script validation feature of the Meridian Enterprise Script Editor, you cannot debug VBScript in the editor. For real debugging, you need a different tool. The tool to use depends on the client application where you want to debug the script:

  • PowerUser provides a link to the Microsoft Script Debugger as described in Microsoft Script Debugger. Although the method described below can also be used with PowerUser, installing and using the Microsoft Script Debugger is just as effective and more convenient.

  • To debug VBScript running in a PowerWeb session, the debugging tool must be installed on the computer running Internet Information Services and you must have administrative rights on the computer. The Meridian vault configuration is cached by your browser during each PowerWeb session. You must log off of PowerWeb to close the current session and then log back on again to load any script changes that you make.

  • All other Windows applications where your VBScript code runs can be debugged using Visual Studio as described below.

The key to debugging VBScript from applications other than PowerUser is the ability of Visual Studio to attach itself to those applications.

Note:

Visual Studio 2008 or higher must be installed on the computer running the application from which you want to debug. Other debugging tools can be used as long as they support attaching themselves to a running process.

ClosedDebug in Visual Studio

To debug VBScript in any Windows application with Visual Studio:

  1. Start the application that hosts the VBScript that you want to debug.

  2. Perform the actions that lead up to the point where your VBScript is about to execute and you want to start debugging.

  3. Start Visual Studio.

    The Visual Studio Start Page appears.

  4. On the File menu, select New Project.

    The New Project dialog appears.

  5. In Project Types:

    1. Expand Other Project Types.

    2. Click Visual Studio Solutions.

    3. Select Blank Solution.

    4. Click OK.

      A new project is created.

      The name of the project is irrelevant because you will not add any code to the project and will discard it when you are finished using the debugger.

  6. On the Tools menu, select Attach to Process.

    The Attach to Process dialog appears.

  7. Enable Show processes from all sessions.

    The Available Processes list refreshes to show additional processes.

  8. In Available Processes, select the name of the executable for the host application that you started in step 1 and click Attach.

    For example, to debug a PowerWeb session:

    1. Select w3wp.exe.

    2. If the Attach Security Warning dialog box appears, click Attach.

      The Solution Explorer opens and lists one or more occurrences of AMScriptHost.

  9. On the Debug menu, select Break All (or press Ctrl+Alt+Break).

  10. Perform the action in the host application that will run the VBScript code that you want to debug.

    The Windows focus switches to Visual Studio and a new window opens, either VBScript - script block [dynamic] if a configuration expression is about to execute or BlueCielo VB Script [dynamic] if a sub-procedure or function in the event handler code module is about to execute. The next statement that will execute is highlighted and execution stops to allow you to debug.

    When script first executes after the process is attached to Visual Studio, the vault's active VBScript configuration expressions and the event handler code module are loaded in Visual Studio. You might have to step over (press F10) some configuration expressions or sub-procedures before the particular expression, sub-procedure, or function that you want to debug is entered. Whenever the event handler code module is loaded, you can set breakpoints in the BlueCielo VB Script [dynamic] window and step through the code similar to debugging in PowerUser as described in Microsoft Script Debugger.

    To open the BlueCielo VB Script [dynamic] window:

    1. In the Solution Explorer, expand Script Documents.

    2. Expand AMScriptHost.

    3. Double-click BlueCielo VB Script.

    Just like with using the Microsoft Script Debugger, to make changes to script code, you must edit it in Meridian Enterprise Configurator, save your changes, reopen the vault in the host application, and restart this task from step 5.

  11. When you are finished debugging, exit Visual Studio without saving the project.

ClosedHost Applications You Can Use to Debug

Following is a list of host applications related to Meridian Enterprise that you can attach to debug VBScript code:

  • Explorer.exe to debug the Application Integration

  • Acad.exe (or other application) to debug title block links

  • ConfiguratorU.exe to debug the Database Import Wizard

  • PowerUserU.exe to debug the Document Import tool

  • W3WP.exe to debug PowerWeb on the web server

ClosedEnable VBScript Logging and Viewing

To further aid in debugging, you can enable logging of VBScript events, command scripts, evaluated expressions, and external function calls. You can enable logging only for PowerUser and PowerWeb.

To enable VBScript logging and viewing:

  1. If PowerUser is open, close it.
  2. In the Windows registry of the client PC, set the following registry values.

The log file is restarted for each client session. The file includes the time, description, and source of the events.

Note:
  • Set the preceding settings in the Wow6432Node branch in the registry for 32-bit clients.

  • Logging is not available for Application Integration or the application links.

  • To add custom messages to the log, see Log method of the Client object.

ClosedView Log with PowerUser

To view the log with PowerUser:

  • On the View menu, point to Arrange Layout and then click Log.

    The Log window can be floated or docked as described in Arrange the Window Layout.

ClosedDownload Log with PowerWeb

To download the log with the PowerWeb:

  1. Enable the Download Log menu command by creating or changing the CanDownloadLog setting to 1 in the user's PowerWeb profile file.

    This is described in Deploy standard preferences and Edit PowerWeb User Profiles.

    If the setting is 0 (default), the menu command is hidden.

  2. Right-click to show the shortcut menu.

  3. In the Miscellaneous group, click Download Log.

    The file downloads to your browser where you can save and view it.

2022 R2