All comments are relative to DIAdem 2020 20.0.0f7762 (64 bit)
Python works properly with the default installation of DIAdem. This means that the Script language DIAdem settings option under SCRIPT is set to 'VBS script' and the 'Python installation' path are NOT set (see image below). If you set these two for Python, then I was unable to get Python scripts to run in DIAdem because I would experience an initialization error.
You may create either VBS or Python scripts in the script panel. Use the Script panel 'file' menu to create a new VBS or Python script.
You can run Python scripts from VBScript using the VBScript ScriptStart() command. As an example, do the following:
Create a VBScript named 'LastScript.VBS'
Option Explicit
Call LogFileDel()
ScriptStart(CurrentScriptPath & "LastScript.Py")
Create a Python named 'LastScript.Py'
from DIAdem import Application as dd
if False:
import DIAdem_CodeCompletion as dd
# --------------------------------------------------------------------
# -- Beginning of user code --
print('hello from Python script')
Run the VBScript and observe the Logfile output at the bottom of the DIAdem script panel.
Although the DIAdem help file doesn't have examples for using Python to interact with DIAdem (objects), you will find that the Python version of objects and commands are so similar, that you can use the VBS reference. Note that the example scripts that come with the DIAdem installation (see C:\Program Files\National Instruments\DIAdem 2020\Examples) holds many Python script examples.
General comments about adapting DIAdem commands from VBS to Python:
See the link script workflow template for a complete Python scripted data processing example. The script includes data import, analysis, View sheet generation, and Report sheet building.
C:\Program Files\National Instruments\Shared\Skyline\Python
Must run open a command window as administrator.
Navitage to the DIAdem installation of Python
C:\Program Files\National Instruments\Shared\Skyline\Python
Navigate into the Python version folder, and then into the Scripts folder in order to access the pip command. Execute pip -V to insure pip works. Perform any necessary install using pip install [module name].
NI installing additional python modules
Do you need help customizing DIAdem using Python for your specific test measurement data management needs? Click on the button below to book a free 1 hour phone / web share consultation.
Sitemap | Copyright © 2020 - 2024 Mechatronic Solutions LLC
Web site by www.MechatronicSolutionsLLC.com | | 2.0620 ms