[python-win32] problem wih vi.run

Tim Roberts timr at probo.com
Fri Sep 2 18:55:49 CEST 2005


On Thu, 1 Sep 2005 15:07:21 -0600, Ananda Regmi <aregmi at gmail.com> wrote:

>Hello Everybody,
> I am running into a strange problem while running a vi through python. 
>Below is my sample code.
>
>lv = win32com.client.Dispatch("LabVIEW.Application.7.1") 
>file_path = 'C:\\Documents and Settings\\administrator\\My Documents\\Python 
>Files\\testvi.vi' 
>vi=lv.GetVIReference(file_path) 
>vi.Run # it stays in this line until the vi finishes running. 
>
>When the execution reached the above line, it gets stuck there. It proceeds 
>to the next line of code only after the vi finishes running. But, I need to 
>change some control value in the Run-Time of the vi. I was wondering if 
>there is any option to select before running the VI which can distinguish 
>between completely running the vi and just starting the vi to run and going 
>to the next line of script. 
>  
>

This is strictly a LabVIEW problem.  No one here will be able to answer 
this question.  You need to check the LabVIEW documentation to see if 
their COM interface offers a way to run the script asynchronously.

If they do not offer a way, you may be able to use multithreading to do 
this, by starting up a separate thread to do the Run, while maintaining 
your control in the main thread.  You'll have to be careful to monitor 
the object lifetime, so you don't try to use the object after it completes.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-win32 mailing list