Python Forum

Full Version: How to give input parameters value while calling the function[VI.Call()] as well?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to Control LabVIEW front panel in python using by ActiveX communication.
I couldn't assign the input parameter values automatically in LabVIEW.
If I run as follows program code it's assigning as 'zero' for both inputs(Input 1, Input 2).
Whenever I tried to run the program the controls taking as default value.
Is there any method for assigning input values while the VI.Call() function(calling and value assigning should happen simultaneously)?.
Give a conclusion for this issue.
I tried VI.Call() function after set input values and the LabVIEW VI taking input values as 'zero'(0).

import win32com.client                                      # ActivX Client
LabVIEW = win32com.client.Dispatch("LabVIEW.Application")   # Connect LabVIEW
VI = LabVIEW.getVIReference(r'D:\New folder\LabVIEW.py')    # Get VI Reference
VI._FlagAsMethod('Call')                                    # Call the VI
VI.Call()
VI.setcontrolvalue('Input 1', '56')                         # Set Input Value
VI.setcontrolvalue('Input 2', '10')                         # Set Input Value
result = VI.getcontrolvalue('out')                          # Get Output Value
print(result)                                               # Print result on console
I expecting input values to be 56 and 53, but the actual inputs are 0 and 0(automatically assigning in LabVIEW as default).
How do I call the VI with these input values?

Let me know, If any concerns