Calling LabVIEW VI from Python

Sathish S sathish at solitontech.com
Tue Jul 13 07:25:33 EDT 2010


Hi ppl,

I'm trying to call the LabVIEW VI's from python. I'm trying to use the Call
method exposed in the LabVIEW activex. this method expects the input values
to be passed as an array of reference. I'm passing a list to it, and I find
that the list is unchanged. Here is my code:

import win32com.client
from win32com.client import gencache
gencache.EnsureModule('{8C8AAA4D-51FE-41DE-85CF-8E6929409012}', 0, 5, 5)
Application =  win32com.client.Dispatch("LabVIEW.Application")


InputNames = ("Cluster","Array","Numeric","Output")

Cluster=("abcd","1")
Array=("1","2.97")
Output=()
Inputs= (Cluster,Array,"5",Output)

Application._FlagAsMethod("GetVIReference")
VirtualInstrument = Application.GetVIReference('C:\Test.vi');
VirtualInstrument._FlagAsMethod("OpenFrontPanel")
VirtualInstrument.OpenFrontPanel(True,3)
VirtualInstrument._FlagAsMethod("Call")
VirtualInstrument.Call(InputNames,Inputs)

print(Output)
print("Output")
VirtualInstrument._FlagAsMethod("GetControlValue")
print(VirtualInstrument.GetControlValue("Output"))
Application._FlagAsMethod("Quit")
Application.Quit();

Thanks,
Sathish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100713/003e05e0/attachment.html>


More information about the Python-list mailing list