Python Forum
How to give input parameters value while calling the function[VI.Call()] as well?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to give input parameters value while calling the function[VI.Call()] as well?
#1
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Uniform Function Call Syntax (UFCS) in Python? thegrapevine 1 2,192 Jun-28-2020, 08:17 AM
Last Post: ndc85430
  special results from calling a function Skaperen 0 2,097 Jun-15-2020, 11:40 PM
Last Post: Skaperen
  Request for input on a talk I was asked to give Phoenix_ZA 4 3,226 Sep-17-2018, 10:24 AM
Last Post: Phoenix_ZA

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020