Run

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.

To stop a script that is running, press the Pause key on the keyboard.

Run a script directly

  1. On the Script tab, in the Scripts group, click Run Script to run a script from a file.
  2. Double-click or click on the Select icon to navigate to the location of the Python script (*.py) file you want to run.
  3. To view the file, right-click on the file name to open it in a read-only text editor window.

  1. (Optional) Enter (or click on the ellipsis button to select) the name of an Outpu t file.
  2. To run a script from a macro, simply add a function call to the Run Script function.

Run a script from the Editor

  1. On the Script tab, in the Scripts group: Click Open Script Editor to create or edit a Python (*.py) script.
  1. On the Script Editor toolbar:
    • click Run (or press F5) to run the current script.
    • click New to open a tab for a new script.
    • click Load to load an existing script.

You can enable an Auto-save script option (via Options | Python Scripting (click the Project tab to open the backstage menu).

You can also use the tools on the Script tab, in the Slots group, to run your favourite scripts and macros.

Script Slots

  1. On the Script tab, in the Slots group: Click Manage Slots to create slots for your scripts or macros. The rows in the grid determine which slots are shown on the Script tab, in the Slots group.Note that only the first 12 script slots are numbered. These slots may be mapped to menu commands and keyboard shortcuts. They can also be included in customisations of the ribbon. Additional slots can only be displayed in the Slots group.
  1. 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.
  2. 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 Script tab, in the Slots group, but you can add more.

  1. Click a slot on the Script tab, in the Slots group, to quickly run a script (or a macro) with a single click of the mouse:

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 filepath and a file name.

To execute a Python script externally you can link to Python.exe and include the name of the script file as a parameter. See: Command Line