01-07-2021 04:39 AM
Hello,
I'm trying to launch a diadem script from labview, with argument. I haven't found out if this is possible and or how.
Thanks for your help.
01-08-2021 08:54 AM
From my experience one of the easiest and most flexiblest ways is to write a wrapping script in a tempfile.
For example:
Option Explicit
scriptinclude "C:\scripts\my_script_including_func1.vbs"
dim factor : factor = 1.2
dim srcpath : srcpath = "C:\temp\src.tdms"
dim targetpath : targetpath = "C:\temp\target.tdms"
call func1(srcpath, factor, targetpath)
How to use
Option Explicit
scriptinclude "@@MYSCRIPTPATH@@"
dim factor : factor = @@FACTOR@@
dim srcpath : srcpath = "@@SRCPATH@@"
dim targetpath : targetpath = "@@TARGETPATH@@"
call func1(srcpath, factor, targetpath)
Maybe this approach helps you.
02-04-2021 08:44 AM - edited 02-04-2021 08:45 AM
Hi,
I honestly do not understand how scriptinclude might help with calling Script from LabVIEW vi?
What works for me and string parameter is this (T1 is DIAdem auxiliary variable, see: https://zone.ni.com/reference/en-XX/help/370858P-01/genas/genauto/genauto_helpvariables/) :
Regards,
Petr.
02-04-2021 11:54 AM
Sorry for making easy things complicated.
I somehow assumed that Using T1 wasn't sufficient 😞
The Idea was the following one which leads to complicated LabVIEW code.
Not sure if it is easier to implement.
C:\myscrips\MyMsgBox_utils.VBS
contains utility methods that I want to call with complicated parameters.
Option Explicit
function MyMsgBox(strVal)
MsgBox strVal
end function
Now I use LabVIEW to generate a temporary file that calls this vbs.
The final temp file will contain:
Option Explicit
call ScriptInclude("C:\myscrips\MyMsgBox_utils.VBS")
dim myText : myText = "Hello moon"
MyMsgBox(myText)
and here comes the complex code
Using this approach you can transport almost any parameters without restrictions.
I attached the VI. I just wanted to explain the approach.
02-05-2021 01:06 AM
Wow,
interesting approach. It is scary, that this is a way to run DIAdem script with params from LabVIEW.
I believe this is not supported anymore?:
PH.
02-05-2021 02:50 PM
Hi pholesovsky,
It is true that the "LabVIEW DIAdem Connectivity VIs" have officially not been supported for many years. However, they continue to work in new LabVIEW and DIAdem versions, year after year. They still work in LabVIEW 2020 and DIAdem 2020, for instance. Also, for many years now, LabVIEW has been installing about half of those VIs with every LabVIEW version in a subfolder of the vi.lib folder. Here's my favorite VI to call to run a script in DIAdem-- you just input the path to the data and the path to the REPORT layout (*.TDR) or VBScript (*.vbs) file to use, and it pops right up.
"C:\Program Files\National Instruments\LabVIEW 2020\vi.lib\ExportToExcel\DIAdem Report Wizard Start CSC.vi"
If that particular VI doesn't suit, you can look through the others that deploy with LabVIEW in that folder. There's a little-known interactive feature in LabVIEW where you can right-click on a graph indicator and choose the context menu "Export Data to DIAdem". That's why these VIs deploy with LabVIEW and have done so for many years now.
Brad Turpin
Principal Technical Support Engineer
NI