Script Editor

The application comes bundled with a minimal version of Python which enables the user to run basic Micromine Origin & Beyond Python scripts and use the Python framework. Advanced users may want to install extra Python modules to increase the power and the flexibility of scripting. This will require a complete install of the official Micromine Origin & Beyond Python distribution. The application will scan the computer at start-up and will use the installed Micromine Origin & Beyond Python distribution if it is available and is compatible with the application.

Note that the application does not guarantee compatibility with all external Python modules as they may not be suitable to be used within the Micromine Origin & Beyond embedded python framework.

The following code will print all the search paths that Python will use to locate the modules it needs (if you are using the Micromine Origin & Beyond Python environment, the path will be <INSTALL_FOLDER>/python/lib):

print(sys.path)

The following page explains how to install the complete Python distribution and suggests some extra Python modules:

https://extras.micromine.com.au/ProductMicromineService/PythonScriptingMM2025.asp

For an example of Scripting Micromine Origin & Beyond Form Sets, see: Script Example.

When you record your actions in the application (See: Record Script), you can load them as a script in the Scripting Editor. You can then edit or run the script.

To open the Script Editor

  • On the Script tab, in the Scripts group: Click Open Script Editor to create or edit a Python (*.py) script.

Open Scripts

You can load an existing script in the Script Editor using the Open button in the tool bar.

When a file contains Tab characters, the Script Editor will prompt you that the script may cause issues.

If prompted, you can click the Visualise Indentation button to enable visualising of whitespace symbols. This will display the characters that need to be removed.

Tabbed Pages

You can open and edit scripts in multiple tabbed pages. There are several shortcut keys:

Action Shortcut
To create a new tab CTRL + T
To close a tab CTRL + W
  Alternatively, click on the tab header with the mouse middle button.
To cycle between tabs CTRL + TAB
  This only applies to the 2 most recently used tabs.

You can also right-click on a tab name and select an option from the context menu.

Syntax Colours

Colours are applied to the text to make the Python syntax more readable. It is easy to differentiate between keywords, function calls, numbers, strings, and comments. Unmatched and matched brackets are also highlighted.

You can use the CTRL key with the mouse wheel to resize the text in the editor window.

Shortcuts

When using keyboard shortcuts make sure the editor window has focus.

Action Shortcut
Open the Script Editor Scripting | Open Script Editor (CTRL + F11)
Select All CTRL + A
To create a new tab CTRL + T
To close a tab CTRL + W
  Alternatively, click on the tab header with the mouse middle button.
To cycle between tabs CTRL + TAB
  This only applies to the 2 most recently used tabs.
Delete selection and copy to clipboard CTRL + X
Copy selection to clipboard CTRL + C
  You can also copy the contents of the Script Editor Help Pane to the clipboard
Paste clipboard to current location CTRL + V
Find CTRL + F
  A search can be case-sensitive and you can search in an Up or Down direction.
Find and Replace CTRL H
   
Comment CTRL + 3
Uncomment CTRL + 2
  If 1 line or no lines are selected, a # comment signifier is added/removed at the start of the current line.
  If multiple lines are selected, a # comment signifier is added/removed at the start of each line.
  Note: You must use the number keys on the main keyboard (not the keypad).
Undo CTRL + Z
Redo CTRL + Y
Save changes CTRL + S
  Click the Save As button on the editor toolbar to save your changes as a new script.
Print CTRL + P
Run the current script F5

Editor Navigation Keys

Use the following shortcuts to navigate the editor window:

Action Shortcut
Move to start of line/document HOME/CTRL + HOME
  If there are leading spaces, pressing HOME once will move the cursor to the first non-whitespace character on the line. Pressing HOME again will move the cursor to the start of the line. Repeated HOME key presses will toggle this behaviour.
Move to end of line/document END/CTRL + END
Scroll up page by page PAGE UP
Scroll down page by page PAGE DOWN
  A "page" is equivalent to the height of the editor window.

See: Script Editor Keyboard Shortcuts

For an extensive list of the available shortcuts, see Keyboard Shortcuts.

Script Editor Keyboard Shortcuts

Keyboard Shortcuts