Formatting text

Relevant for: GUI actions, scripted GUI components, and function libraries

When working with actions, scripted components, or function libraries in the Editor, it is important to follow accepted VBScript practices for comments and indentation.

Comments

Use comments to explain sections of an action, a scripted component, or a function library. This improves readability and makes your scripts easier to maintain and update. For details, see Comments.

  • Adding Comments. You can add comments to your statements by adding an apostrophe ('), either at the beginning of a separate line, or at the end of a statement.

    You can comment a selected block of text by choosing Edit > Format > Comment. Each line in the block is preceded by an apostrophe.

  • Removing Comments. You can remove comments from your statements by deleting the apostrophe ('), either at the beginning of a separate line, or at the end of a statement.

    You can remove the comments from a selected block or line of text by choosing Edit > Format > Uncomment.

Indentation

Use indentation to reflect the logical structure and nesting of your statements.

  • Indenting Statements. You can indent your statements by selecting the text and choosing Edit > Format > Indent. If you want to indent multiple lines, you can also select the text and press the Tab key.

    The text is indented according to the Tab spacing selected in the General pane of the Text Editor tab in the Options dialog box (Tools > Options > Text Editor tab > General node). For details, see General Pane.

  • Outdenting Statements. You can outdent your statements by selecting Edit > Format > Outdent or by deleting the space at the beginning of the statements.

For more detailed information on formatting in VBScript, you can view the VBScript documentation from the UFT Help menu (Help > HPE Unified Functional Testing Help > VBScript Reference).