VEScripts Editor

The VE includes an integrated editor / debugger / console solution for developing VEScripts from inside the <VE>. This Python editor is modeless so activating it will not stop you from working with the rest of the VE.


To launch the VEScripts editor, use the VE Tools menu, VEScripts… entry (appropriate licence required for entry to be visible).


The editor consists of the following elements:

File List

By default, the File List will show the scripts that are included with the VE. Add your own scripts by right-clicking anywhere in the File List and selecting “Add script folder”. To remove a scripting folder, right-click on the top-level node for that folder and select “Remove folder”. The VE scripts folder cannot be removed. To force a refresh of the File List content, right-click and select Refresh. Only files with the “.py” extension will show up as scripts.

The File List right-click menu also allows you to “Promote to Navigator”. This inserts the relevant script file into the VE Python Scripts navigator. See Chapter 3 for further information on running scripts.

Selecting a script in the file list will load its content into the editor in a new tab (or if already loaded, its tab will be brought to the foreground). The currently active script is shown in bold.

Scripting Toolbar

Allows access to basic features of the scripting dialog. It has the following entries:

Save: drop-down menu (Save current tab, Save As… current tab, or Save All tabs). When trying to Save the content of a tab that is Untitled (no file name), you will be prompted to select a filename/location.


New: create a new, empty, untitled script file tab


Run: run the script in the current editing window. If the script was edited, you will be prompted to save it first (shortcut key: F5).


Configure: Show the configuration dialog with display options for the Editor


Help:

Python Documentation: takes you to the Python documentation page for Python 3.12 VE Automation API: This document


Debug:

Run Debugger (Shift + F5): start the current script in debug mode. Pause Debugging (Ctrl + B): pause current running script Continue (F5): if paused, continue running the script Step In (F11): step execution, going into a function if possible Step Over (F12): step execution, do not go into function (execute function in 1 step) Step Out (Shift + F11): continue execution until we’re out of the current function Stop: if running or paused, stop executing the script

Code Editing Window

Output Window / Output Window Toolbar

Any output from the Python “print” statement will be directed here. Any run-time errors, syntax errors etc. will also be reported here.

You can double-click on a line number in the output window (for example as part of an error message) and the editor will automatically move the cursor to that line. Similarly, if you double-click a function name, the editor will try and locate that function in the current file and place the cursor at that function.

The Clear button in the toolbar clears its contents. The Stop button will be enabled only whilst a script is executing, and can be used to abort the currently running script.

Help Window

Provides output from Python’s integrated help function. Highlight an API function in the editor and right-click -> Help to invoke Help. Note that the Help system may need to be told which module a function is in, for best results a function call will need to be prefixed with its module / parent class. For instance, to see help on a profile function called is_yearly, run help on iesve.GroupProfiles.is_yearly.

Watch Window

To add a variable to the Watch window, type or paste its name into the first column, or select the variable in the editor and right-click-> Add. To remove a Watch variable, delete its name, or press the “Clear” button when the Watch tab is active.

To see detailed variable content, the Watch window supports copy to Clipboard (Ctrl + C, or right-click -> Copy). A watched variable is displayed red if its value has changed since last run. Greyed out variables are not recognized or not available.

When debugging and paused on a breakpoint, you can stop the current script from executing by pressing the Stop button (output toolbar).

Breakpoints

Click to the right of line numbers, or press F9 on a line, to set / remove breakpoints. Breakpoints are only active when running a script through the Debug command. (Shift + F5).

In Debug mode, the active line of execution is indicated with a yellow arrow. Use the Watches window to view variables / contents.

Editing a script whilst debugging will confuse everyone and cause line number mismatches with breakpoints.

Keyboard shortcuts when in Breakpoint / debugging paused mode: