DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

launch Diadem script from labview with argument

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.

0 Kudos
Message 1 of 6
(2,394 Views)

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

  • create a template string with some placeholders
Option Explicit
scriptinclude "@@MYSCRIPTPATH@@"

dim factor : factor = @@FACTOR@@
dim srcpath : srcpath = "@@SRCPATH@@"
dim targetpath : targetpath = "@@TARGETPATH@@"

call func1(srcpath, factor, targetpath)
  • Use string manipulation to fill in your parameters
  • Save the final string to a temporary file
  • Let DIAdem execute this script
  • delete the temporary file

Maybe this approach helps you.

0 Kudos
Message 2 of 6
(2,356 Views)

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/) :

DIAdemCallScript.PNG

 

 

 

 

 

 

 

Regards,

Petr.

0 Kudos
Message 3 of 6
(2,187 Views)

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

 

AndreasK_0-1612460999950.png

Using this approach you can transport almost any parameters without restrictions.

I attached the VI. I just wanted to explain the approach.

 

Message 4 of 6
(2,182 Views)

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?:

ftp://ftp.ni.com/support/diadem/LabVIEW_Toolkit/manual%20installation/MANUALS/LV%20DIAdem%20Tools.pd...

 

PH.

0 Kudos
Message 5 of 6
(2,171 Views)

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

0 Kudos
Message 6 of 6
(2,160 Views)