As of enDAQ Lab 2.0, Lab now provides the Scripting menu which enables advanced users to programmatically interact in Python with many of the components of enDAQ Lab. The scripting interface uses Python version 2.7, and we plan to move to Python 3 in the near future. This page aims to familiarize you with the various features that the Scripting menu offers.
In this Article
Enabling the Scripting Menu
Scripting is disabled and hidden by default. To use it, it must first be enabled in the Preferences In the main window’s menu bar, select Edit → Preferences to bring up the preferences dialog:
In the dialog, check the Enable Scripting box:
Click Save to save the change and close the dialog. You should now have a Scripting menu in the menu bar of the main window:
The Scripting menu makes available a Python Console, where users can dynamically interact with the enDAQ Lab application. This is a great tool to use if you want to investigate your data, test out an experimental scripting idea, or just want to explore enDAQ Lab’s Python API.
To open the Python Console navigate to the main window’s menu bar, select Scripting → Open Python Console:
The Python Console should open in a new window:
This window behaves much like a Python Console on the command-line; Python code statements typed in will be executed in the enDAQ Lab environment on pressing Enter:
The Script Editor is a text editor for writing Python scripts to run in enDAQ Lab’s Python environment. This is a great tool to use if you want to execute a longer set of instructions at once, or make a set of instructions that you can reuse in the future.
To open the Script Editor, go to the main window’s menu bar and select Scripting → Open Script Editor:
The Scripting Editor should then open in a new window:
From this window, you can perform many of the common text editor functionalities, like opening/saving files, find and replace, etc., through the File and Edit menu items.
Once you have a complete script, you can run your code by clicking Script → Run Script. This will run your code in the Python Console, where you can view any outputs or errors.
Developer Docs & Example Scripts
We are in the process of publishing/hosting this documentation in a more accessible manner; but in the meantime the documentation on how to interface with the IDE files in the script editor along with some example scripts are provided here: Download Developer Documentation & Example Scripts.
Once downloaded, unzip the folder and open the index.html file under the HTML folder. An image of this is provided below which highlights the extent of the documentation!