开发者

How to control LabView VI front panel switches (on/off, bar adjuster) using Python scripts?

开发者 https://www.devze.com 2023-01-12 12:59 出处:网络
I have a LabView front panel controlling switches and sensor voltage adjustors to the hardware and need to control these with a Python script. I do not have much knowledge of LabView. Pl开发者_如何学P

I have a LabView front panel controlling switches and sensor voltage adjustors to the hardware and need to control these with a Python script. I do not have much knowledge of LabView. Pl开发者_如何学Pythonease explain how this could be done.


I found one reference on the LabVIEW discussion board that succeeded in this, it uses the following code:

import win32com.client //load the interface
labview = win32com.client.Dispatch("Labview.Application") //get a ref to the Labview application
VI = labview.getvireference(r'C:\TEMP\python.vi') //load the VI
VI.setcontrolvalue('Numeric','5') //set the control 'numeric' to 5

It seems like you need the win32com.client library in Python.


You can also push data between LabVIEW and Python using Mark E. Smith's excellent XML-RPC package.

0

精彩评论

暂无评论...
验证码 换一张
取 消