Script Editor
Micromine comes bundled with a minimal version of Python which allows you to run basic Python scripts. The Python scripting language includes comprehensive mathematical tools and tools that allow you to create custom user interfaces. Third-party packages and libraries are available that provide geospatial, statistical, and graphing solutions.
To take advantage of these advanced features, you can install extra Python modules to increase the power and the flexibility of the scripting environment.
Note: Micromine Scripting is currently only compatible with Python version 3.5.x. (If you are running Micromine 64-bit, you will need to install the windows X86-64 MSI Installer.)
The complete Python installer for Windows can be found on the Python website. For more information about Micromine Scripting, click on the following link: http://extras.micromine.com.au/ProductMicromineService/PythonScripting.asp
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 Python environment, the path will be <MICROMINE_INSTALL_FOLDER>/python/lib):
print(sys.path)
When you record your actions in the Micromine workspace (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 window:
- Click the Script Editor button on the Scripting toolbar:
Or select Scripting | Open Script Editor (CTRL + F11):
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.
Note: You can use the CTRL key with the mouse wheel to resize the text in the editor window.
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. |
Comment / Uncomment
Use the following shortcuts to comment or uncomment lines of code:
Action | Shortcut |
---|---|
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 / Redo
Use the following shortcuts to undo or redo your edits:
Action | Shortcut |
---|---|
Undo | CTRL + Z |
Redo | CTRL + Y |
Note: You can also use the Scripting Toolbar to open the Script Editor, start and stop recording a script and run your favourite scripts and macros.