07-10-2019 12:18 AM
Hi
I need connect two scripts together.
One script is write in python, for BETA/CAE (Meta) sw. This script convert special data format THP to DIADEM format
Second script, processing this diadem format in DIADEM soft. Diadem working with VBA lang.
Can you help me how to connect this 2 sw together ?
It is possible connect DIADEM with another sw together in the subprocess ?
It is possible run diadem script from terminal or cmd ?
For BETA/CAE sw the command is meta -s myScript.py
Have DIADEM similar possibilities ?
thanks for answers
Dalibor Zeman
Solved! Go to Solution.
07-11-2019 09:53 AM - edited 07-11-2019 09:54 AM
Hi Dalibor,
As of DIAdem 2019, there is no built-in ability to call python scripts from a DIAdem VBScript. The methods available are to execute DOS commands with the ExtProgram() function or to call external ActiveX servers with the CreateObject() function.
It is possible to call a LabVIEW program from a DIAdem VBScript with the LVRuntime object. If you can call your python script from LabVIEW, that might be a way to get this to work.
Sorry I don't have better news,
Brad Turpin
DIAdem Product Support Engineer
National Instruments
07-11-2019 02:50 PM
Hi Dalibor,
I have good results with calling Python code using the "extprogram" command from DIAdem.
The tricky part was how to transfer parameters between DIAdem and Python.
For this I would recommend using a Dictionary, and then converting the dictionary to string, and then to file. DIAdem 2019 has a new nice JSON converter that allows you to convert a dictionary to json and then to file. Then can read that in python easily.
This would allow quite a bit of flexibility in parameter passing.
Paul
Viviota.com
07-12-2019 01:40 AM
Hi Brad
thanks for help, using CreateObject() works.
Dim oShell
SET oShell = CreateObject("Wscript.Shell")
'INSERT path where is save main script for Meta sw - python script
Dim source_code_path
source_code_path = "C:\Users\....\DefaultPythonScripts\subDiadem02.py"
'INSERT path where is save DSY file for convert THP to DIADEM
Dim variable1
variable1 = "G:/........._588_2015.DSY.fz"
Dim currentCommand
currentCommand = "cmd /c " & Chr(34) & source_code_path & " " & variable1
oShell.run currentCommand,1,True
This call another soft (Beta/CAE) with using Python, run python scripts.
Rest of scripts is diadem.
Thanks
Dalibor Zeman
CAE engineer
TUV SUD CZ