Run Script
When you have recorded a script you can run the script to perform the actions you have recorded. You can also build and run a script from the editor, or run a script from within a macro.
Note: To stop a script that is running, press the Pause key on the keyboard.
Run a script directly
- Select Scripting | Run Script | From File.
- Double-click or click on the Select icon to navigate to the location of the Python script (*.py) file you want to run.
Tip: To view the file, right-click on the file name to open it in a read-only text editor window.
- (Optional) Enter (or click on the ellipsis button to select) the name of an Output file.
Tip: To run a script from a macro, simply add a function call to the Scripting | Run Script | From File function.
Run a script from the Editor
- Click the Script Editor button on the Scripting toolbar:
Or select Scripting | Open Script Editor (CTRL + F11):
- In the Editor window:
![]() |
Click the Load button to load the Python (*.py) script you want to run. |
![]() |
Click the Run button to run the script. |
Tip: You can enable an Auto-save script option (via Tools | Options | Script).
You can also use the Scripting toolbar and menu to run your favourite scripts and macros using toolbar and menu shortcuts or 'slots':
Script Shortcuts
- Click the Script Slots Manager button to create slots for a maximum of 12 scripts or macros. The rows in the grid correspond to the slots available on the Scripting | Run Script menu.
- To create a script or macro shortcut, double-click in a row of the grid and navigate to the name of the Python script (*.py) or Macro (*.MCR) you want to be able to run from the Scripting toolbar or menu.
- Open the Scripting toolbar drop-down menu and select Add or Remove Buttons | Customise.
- On the Commands tab of the Customise dialog, select the Scripting category.
- Use the mouse to click and drag the Run Script command onto the toolbar.
- Open the Run Script drop-down menu and use the mouse to select a Slot and drag and drop it onto the Scripting toolbar.
- After adding additional slots, you can then right-click on the Run Script button and select Delete to remove it from the toolbar.
A maximum of 12 script shortcuts or slots can be setup in the Script Slots Manager (see below). By default, 1 to 4 slots are available on the toolbar, but you can customise the toolbar to add more:
- Select a slot on the Scripting toolbar to quickly run a script (or a macro) with a single click of the mouse:
- Alternatively, select a slot on the Scripting | Run Script menu. All 12 slots are available for selection.
Run a script from a hyperlink
You can use the Link field associated with the data in a Vizex (Point, String, Drillhole Event or Interval) layer to execute a Python script in the current session. See: Interactive data links
If you only specify the name of the Python script file in the Link field, the script will be executed provided it exists in the project. To run a script that is not located in the current project folder, specify a file path and a file name.
Note: To execute a Python script externally you can link to Python.exe and include the name of the script file as a parameter.