DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

DIADEM_run_script

Solved!
Go to solution

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

 

 

 

0 Kudos
Message 1 of 4
(2,463 Views)
Solution
Accepted by topic author DaliborZeman

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

0 Kudos
Message 2 of 4
(2,419 Views)

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

 

0 Kudos
Message 3 of 4
(2,413 Views)
Solution
Accepted by topic author DaliborZeman

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



0 Kudos
Message 4 of 4
(2,406 Views)