Running Scripts in PowerDesigner

You can run VBScript scripts in your PowerDesigner client by selecting Tools > Execute Commands to open the Edit/Run Script dialog. Output from the script is printed to the Output window.



The following tools are available on the Edit/Run Script dialog toolbar:

Tools

Description

Editor Menu [Shift+F11] - Contains the following commands:
  • New [Ctrl+N] - Reinitializes the field by removing all the existing content.
  • Open... [Ctrl+O] - Replaces the content of the field with the content of the selected file.
  • Insert... [Ctrl+I] - Inserts the content of the selected file at the cursor.
  • Save [Ctrl+S] - Saves the content of the field to the specified file.
  • Save As... - Saves the content of the field to a new file.
  • Select All [Ctrl+A] - Selects all the content of the field.
  • Find... [Ctrl+F] - Opens a dialog to search for text in the field.
  • Find Next... [F3] - Finds the next occurence of the searched for text.
  • Find Previous... [Shift+F3] - Finds the previous occurence of the searched for text.
  • Replace... [Ctrl+H] - Opens a dialog to replace text in the field.
  • Go To Line... [Ctrl+G] - Opens a dialog to go to the specified line.
  • Toggle Bookmark [Ctrl+F2] Inserts or removes a bookmark (a blue box) at the cursor position. Note that bookmarks are not printable and are lost if you refresh the tab
  • Next Bookmark [F2] - Jumps to the next bookmark.
  • Previous Bookmark [Shift+F2] - Jumps to the previous bookmark.

Edit With [Ctrl+E] - Opens the previewed code in an external editor. Click the down arrow to select a particular editor or Choose Program to specify a new editor. Editors specified here are added to the list of editors available at Tools > General Options > Editors.

Save [Ctrl+S] - Saves the content of the field to the specified file.

Print [Ctrl+P] - Prints the content of the field.

Find [Ctrl+F] - Opens a dialog to search for text.

Cut [Ctrl+X], Copy [Ctrl+C], and Paste [Ctrl+V] - Perform the standard clipboard actions.



Clear - Deletes the script in the dialog.

Undo [Ctrl+Z] and Redo [Ctrl+Y] - Move backward or forward through edits.

Multiple levels of Undo and Redo are supported but , if you run a script that modifies objects in several models, you must use the Undo or Redo commands in each of the models called by the script.

Run [F5] - Runs the script. Output is printed to the Output window.

If a compilation error occurs, a message box is displayed, a brief error description appears in the dialog's Result pane, and the cursor is set at the error position.

You can catch errors using the On Error Resume Next statement, unless the script is called in the im_Abort interactive mode (see .set_interactive_mode Macro).

Find in Metamodel Objects Help [Ctrl+F1] - Opens the PowerDesigner metamodel objects help file, which provides detailed information about all the attributes, collections, and methods available for each metaclass.