To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This example will show you how to load a LabVIEW VI into memory, pass in data and retrieve data using VB script from DIAdem.
Description
Using the LVRuntime object and methods in VB script, we can use LabVIEW VIs to perform tasks not possible in DIAdem. This example shows how to use a simple VI from DIAdem script. For more information please see the following whitepaper:
Calling a LabVIEW SubVI with DIAdem
Requirements
Steps to Implement or Execute Code
Additional Information or References
VBS Script Code:
Option Explicit 'Forces the explicit declaration of all the variables in a script.
'Set up variables
Dim PathtoVI, VI, Answer
'Build VI filepath from path of script
PathtoVI = CurrentScriptPath + "Two Variables Add Operation 2012 NIVerified.vi"
'set LabVIEW Run Tim version
LVRuntime.Init "12.0"
'Load VI into memory for use
Set VI = LVRuntime.LoadVI (PathtoVI)
'Pass inputs into VI
VI.SetControlValue "input 1", 15
VI.SetControlValue "input 2", 18
'Do not synchronously start VI
VI.Run False
'Get output from VI
Answer = VI.GetControlValue ("output")
'Shows output in a dialog box
Call msgboxdisp (Answer)
'Unload LabVIEW runtime and VI
LVRuntime.DeInit
**This document has been updated to meet the current required format for the NI Code Exchange.**
Description-Separate-2Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.