Navigation:  Using Visual Build > Dialogs >

Script Editor Dialog

Previous pageReturn to chapter overviewNext page

The Script Editor allows viewing and editing of scripts, step events, and user action script code within Visual Build.  It can be accessed via the View menu, and from the Step properties dialog.  The Script Editor has its own menu and toolbar, which can be customized as desired. Keyboard shortcuts are also configurable.

 

Script functions defined in the Script Editor can be used within script expressions in step fields, in the Run Script action, and any event functions called during a build.

 

ScriptEditor

 

There are five (5) types of scripts, with one tab entry for each type:

 

Temporary: Scripts that exist only for the current Visual Build instance.  They are created by adding them to the Temporary tab or by loading them from a file during a build using the object model.

 

Project: Saved with the project file.

 

Global: Global across all projects; stored in the VisBuildPro.Global.scripts file in the configuration files path.

 

System: Built-in scripts that are installed with Visual Build, stored in the VisBuildPro.System.scripts file in the install path, and are overwritten during installation.

 

Step/Action: Used to define event functions for an individual step or to define the script code for a user-defined action.  This tab is only displayed when the Script Editor is launched from within the step properties dialog or the component tab of the action properties dialog.

 

Unlike macros, where macros of the same name can override another based on their precedence, all the script of each type is concatenated together and added as global items that are accessible to all script code.  Script functions names prefixed with vbld_ are reserved for use by the Visual Build system scripts.

 

Notes:

To create a temporary macro in script code (VBScript), use
 
Set objMacro = vbld_TempMacros.Add("MACRO_NAME", "macro value")
or
Set objMacro = Application.Macros(vbldMacroTemporary).Add("MACRO_NAME", "macro value")

 

The Script.bld sample demonstrates common script functionality, including creating or incrementing a macro value, if/else logic, script expressions in build rules, etc.
Script code entered in the script editor cannot reference macros directly -- use the script code Application.ExpandMacrosAndScript("%MYMACRO%") instead of "%MYMACRO%".  However, macro references entered in the Immediate window will be expanded, and script entered in the Run Script action and within brackets in other step properties can reference macros directly.
Script code entered on the Step tab is only in scope for step script event methods.

 

Immediate Window

 

The Immediate window is useful as an aid in debugging script code and script expressions.  Type an expression in the field, optionally prefixing with ?, and press Enter or click the Evaluate button to evaluate the script code (the result is displayed in the Immediate window below the typed expression).  Use the Insert item on the File menu to insert the script from the current line in the Immediate window into the current control in the Step properties dialog (if the Script Editor was accessed from the Step properties dialog) or to insert into the Watches pane.  Choose Search | Go To Last Error on the menu bar to navigate to the script code line where the last error occurred.

 

 

Notes: This dialog requires that the MSXML parser (version 3.0 or later) be installed for syntax highlighting and code completion functionality.