LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use a VI to perform a function in another, parallel running program on Windows XP?

I have a state machine based VI that moves moves a sampling actuator into exhaust gases that we would like to sample.  One of the states is a sampling process where our diagnostic equipment (gas chromatograph) sucks in the sample and analyzes it.  Unfortuntately, the GC is so old, that I can't find a way to make a Labview driver for it.  However, it does have its own software that can trigger it.

 

 If I was to do it manually, I would just click a button on the GC's program that says "Sample".  What I would like to do is have my Labview VI do this autonomously ever time it gets to the sampling state.  I have a feeling this involves the Windows API or DirectX but I have absolutely no clue on where I can look to perform such an operation.  

 

Would anybody be able to offer me any assitance, know-how or direction for this vexing question?

 

Thank You,

Tei

 

 

0 Kudos
Message 1 of 14
(2,539 Views)

In the absence of drivers, a rather nasty way to achieve this would be to ensure that your software always occupies the same portion of the screen such that you know the position of the 'sample' button. You could then simulate a mouse click at those coordinates when you require a sample to be taken.

 

This would not be a robust solution as a user could move or minimise the window, or other windows could also find their way into the critical position and cause the application to work incorrectly or cause unexpected things to happen.

However, if you just need a short term work around this method might be acceptable, just be aware of the risks if you try it.

 

Searching for simulate mouse clicks and having a play is the way forward.

 

As an example of simulating a mouse click in a certain position, have a look here:

http://forums.ni.com/t5/LabVIEW/Programatically-Selecting-a-ring/m-p/1463242#M557128

 

Ian

0 Kudos
Message 2 of 14
(2,536 Views)

So, I'm trying to read the link that you sent but I'm not quite sure what a "ring" is.  Seems fairly simple if I just select the system32.dll and then the mouse click function.  But, How would I input the coordinates and know where the coordinates are?

 

Thanks,

Tei

 

0 Kudos
Message 3 of 14
(2,531 Views)

I would recomend AutoIT. You can search the forum for LabVIEW examples of it's ActiveX interface.

0 Kudos
Message 4 of 14
(2,526 Views)

 


@avtr wrote:

So, I'm trying to read the link that you sent but I'm not quite sure what a "ring" is.  Seems fairly simple if I just select the system32.dll and then the mouse click function.  But, How would I input the coordinates and know where the coordinates are?

 

 


 

Don't worry about the ring control - thats just an example. You would need to position your GC window in a known position and not move it. A little trial and error would allow you to learn the coordinates for the mouse click.

 

That said, Dennis' suggestion sounds an awful lot better for several reasons! Have a look at the link he provided.

0 Kudos
Message 5 of 14
(2,480 Views)

Thanks both Dennis and Ian.  So, after looking at the link for AutoIt, I still don't understand why it would be better (or easier) than just directly controlling Windows from Labview.  I'll try and read more of their documentation.  Thanks for the direction.

 

-Tei

 

 

0 Kudos
Message 6 of 14
(2,467 Views)

AutoIT is just simpler to use. It has a utility that provides the windows handle and the coordinates of a button inside of it. I needed to control another windows program a short while ago and I had it working in a very short while.

0 Kudos
Message 7 of 14
(2,463 Views)

And so then you can just use ActiveX to control AutoIt from Labview?

0 Kudos
Message 8 of 14
(2,460 Views)

Yes. You can either create a script that you load and run or use ActiveX to call functions such as ControlClick where you can give coordinates or just the control name.

0 Kudos
Message 9 of 14
(2,456 Views)

All right, so I've been messing around with this AutoIt and I think I need some help to perform this seemingly simple activity.  No offense to the Labview forums but would any of you be able to quickly tell me what functions I should look for in order to find a specific button on my GC program?  How long of a script will I need in order to do this task?

 

Thanks,

Tei

 

 

0 Kudos
Message 10 of 14
(2,435 Views)