From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running VIs from Python using ActiveX

I have a collection of VIs that I want to execute from Python, so I'm accessing LabVIEW through ActiveX. Generally everything works fine, but there's a thing that puzzles me. The outcome of the VIs seems to vary with how I set the input parameters and also if the VI is pre-opened (manually) or not (where not is desired).
One VI gives the expected result if run like this:
....
inputParams = ["param1"]
inputValues = [value1]
viReference.Call(inputParams, inputValues)
...
 
Another VI works fine like this:
...
viReference.SetControlValue("param2", value2)
viReference.Call()
...
 
And a third VI needs this odd setup to work as expected:
...
viReference.SetControlValue("param3", value3)
viReference.Call(["param3"], [value3])
....
 
I have probably made mistakes elsewhere in the code, but I wonder if there's a "rule-of-thumb" how to pass values to a VI? When to use SetControlValue and when to use Call with arguments?
 
Thanks,
 
Ola
0 Kudos
Message 1 of 3
(2,594 Views)
I'm not sure about all the examples you've listed, but one common mistake is to not have the front panel controls and indicators mapped to terminals of the VI. If you are going to pass the arguments to the Call, they must all be terminals of the VI. You can use SetControlValue, however, on any front panel control.
0 Kudos
Message 2 of 3
(2,575 Views)
Thought you might be interested in this post...
 
 
0 Kudos
Message 3 of 3
(2,522 Views)