NI AWR's Script Development Environment (SDE) allows you to create and execute macros and utilities to automate complex tasks from within the NI AWRDE. The SDE supports scripting in Visual Basic, and includes syntax highlighting and powerful debugging capabilities.
The Scripting Editor contains BASIC script modules that you can run from the program by choosing
or directly, or from within the SDE.The language used in scripts is SAX Basic, a subset of Microsoft® Visual Basic® for Applications. SAX Basic language online Help is available here: AWR_V13_API_Diagram.pdf
Components of the Script Development Environment
To open the SDE, choose or click the toolbar button. The NI AWR SDE window opens.
The major components of the SDE are described in the following table:
Name | Description |
---|---|
Project | Script Project Browser (or simply, Project Browser). Allows you to create scripts to automate tasks within the NI AWRDE. The scripts display as two subnodes. The first subnode, Global, contains global modules. The second subnode, Projectname.emp, contains project-specific modules. |
Menus | A set of menus: | , , , , , and .Most of the menu choices and commands are also available as buttons on the toolbar.
Script workspace | The area in which you design, run, and debug scripts. |
Immediate/Watch/Stack window | The area in which you can print the results of a running script and watch the value of the variables during the debugging process. |
Toolbars (Standard, Debug and Edit) | A row of buttons that provides shortcuts for editing, running, and debugging scripts; creating new Code Modules; accessing VBA Object Browser Help; adding available references to a Project; and for accessing Immediate, Watch and Quick Watch Windows.To view a tool tip for a particular toolbar command, pass the cursor over the button. |
Project Browser
The scripting browser is along the left side of the SDE and organizes the scripts available in the project. Scripts can be either global, or local to a project. If a script is general purpose and can be used with many projects, you should save it as a global script. If the script only works with a specific project, you should save it as a local script.
Local Modules
Shown in the scripting browser with the name of the project, in this example “Untitled Project.emp”. Local scripts are saved in the project, so if you copy your project file to another machine, your scripts are automatically included.
Global Modules
Scripts stored in the Scripts or ScriptsUser folders are included in this. From the NI AWR Design Environment, select Help > Show Files/Directories to find these folders. Scripts folder contains the factory scripts shipped with the product installer. ScriptUser contains global scripts that the user manages. Global scripts are available to all projects. The Global subnode contains all global scripts that are stored separately in individual *.bas
files located in specific folders on your computer. You can add a new *.bas
file to your ScriptUser folder, then right-click the Global node and choose to make the new script available.
To define more than one global script folder, add the following line in your User.ini
file:
[File Locations] Scripts=$DEFAULT;<path>
where <path>
is the full or relative path to the folder to search for additional *.bas
files. You can add more than one path by separating paths with semi-colons. PDKs can also specify a scripts file location, so scripts can be shipped with PDKs and loaded automatically as global scripts.
Speed Menus
Right click in the scripting browser to get the following menu commands:
Command | Description |
---|---|
View Code | Opens that code module for editing. |
Run Sub Main | Run the Main subroutine in that code module. |
Insert Module | Insert a new code module. |
Rename | Rename the selected module. |
Remove | Remove (delete) the selected module. |
Export | Save the module to disk as a .bas file. |
Print the selected module. | |
Import | Import a module from disk (only in Local Modules). |
Check for New Files | Add any new files in the global locations to the SDE (only in Global Modules). |
References
Object Browser
Menus (do we include the menu descriptions from the Sax Basic Document?)
File Menu
The File menu provides the normal options.
Item | Description |
---|---|
MWOffice | Switch control to the AWR Design Environment |
Save | |
Print Setup | |
Close |