Jump to content

Communicating with windows applications


Recommended Posts

Hi all - This is my first post here and I have been looking for some help with this problem I am having now for a couple of days. I have been trying different things along with using NIs website and cannot find a solution. I found this website after finally trying to see if Google could help out. Looks cool so far so let me give this a whirl.

I am trying to launch a program using the system exec VI in my main VI. That part is easy. The next thing I am trying to do is to send commands within that window that is open. I have been trying virtual keyboards and things of that nature. I also have been coming across active x controls but do not really understand what they are used for. Does anybody have any ideas as to how I would communicate with a (in my case a DOS window) after using the system exec command to open it? Also what exactly does active x do and can it be a part of what I am trying to do here? I have searched through the forums here and did not really see anything that could help me out so I thought I would give this a try. Any help will be appreciated.

Link to comment

Try and be a little more specific.

I launch <program X> using system exec.vi (give the real progarm name

I want to send <example input string> to do <fill in the functionality>

Have you considered batch files? Have you looked for DOS window tools? Did you write the DOS program. What the heck are you doing in a DOS windows these days anyway? If you have a good reason to be there, explain. Is there possibly a Windows only way to do what you are attempting. Etc, Etc. Be specific if you want help. Generalitites don't get much help on this forum. Give us some specifics to bite off and chew and we might get interested.

AcrtiveX is a microsoft component technology. It has a defined interface and allows one program to control and communicate with the componenets that are part of the ActiveX portion of a program. LabVIEW can call ActiveX nodes. Look in the LabVIEW examples and on NI.com.

Link to comment

There are two types of activeX server you can use with LabVIEW. One is an activeX server provided by other windows application. If your window's application provides activeX control, you can call this activeX control's methods and properties within LabVIEW. You can search LabVIEW examples for that, for example, Excel provides activeX control, LabVIEW has an example to show how to read and write to Excel within LabVIEW.

The second type of activeX is LabVIEW itself as an activeX server. You can call LabVIEW activeX server from C++ or VB. Below are the links from NI side:

This is the link of calling LabVIEW activeX server from C++:

http://sine.ni.com/apps/we/niepd_web_displ...034080020E74861

This is the link of calling LabVIEW activeX server from VB:

http://sine.ni.com/apps/we/niepd_web_displ...034080020E74861

In your case, it sounds like the first case that if your third party window's application provides activeX control, then you can call it within LabVIEW. It is the easier way than the second type because all work is just LabVIEW wiring, not writing C++ or VB code.

Hope this will give you some hints on activeX control.

Irene

Link to comment

As said before, the key here is the degree of control you have over that DOS application. ActiveX is the easiest way of communication between two applications, but it requires the app is prepared for it (or, as Irene_he points, the possibility of changing its code). You always can try DDE, the old way of cross-application comm, still supported by LV, but you will have the same problem if that app is not prepared for DDE. Or reading/writing files for exchange info...

If you don't have any control over that DOS program... I don't see any solution right now :thumbdown:

Saludos,

Aitor

Link to comment

OK here are the specifics - The DOS window that I am launching is cygwin. I work for a satellite communications company and I use Labview to test our modems firmware before release. A test that I perform is a program that our s/w developers wrote that passes udp traffic. It is written in Linux, which is our O/S on our modems, so I use cygwin to run the traffic program. So what I am trying to do is to start cygwin using system exec, send a command to start the test via the cygwin window, and monitor the traffic in another cygwin window on the receiving end. I know I can launch the cywin window and then use the simulate keyboard VI to send the commands. I just wanted to know if there was an easier way. Also on the receive side how do I monitor what is being displayed in the cywin window there? I can also accomplish what I want to do using the Putty program.

So what I have found by looking around is I can open my cygwin window, send the commands to it using the windows scripting host invoke node and execute the test. Now the other half of the problem is how do I monitor what is being received in that window. In other words I have data that is being continuously updated in the receiver window that I have to monitor. Any ideas...?

Link to comment
OK here are the specifics - The DOS window that I am launching is cygwin. ... A test that I perform is a program that our s/w developers wrote that passes udp traffic. It is written in Linux, which is our O/S on our modems, ... I just wanted to know if there was an easier way. Also on the receive side how do I monitor what is being displayed in the cywin window there? ... Any ideas...?

Hmmm, I've used Cygwin, but only a little bit here. Of more interest is the Linux angle. Can you, or your SW developers add in a TCP socket, either directly or using Tcl/Tk? We did that on a telescope control project I was involved with. We had a legacy code astrometric kernel that we talked to using Tcl/Tk with the TCP socket. Worked fine. Was not hard to code up. We also did the same thing for a while using pipes under linux.

This might entail a little more upfront work, but has the advantage that once you have the Tcl/Tk-TCP method in place you also have a very flexible (and quick) method of adapting to other issues that may come up. We found the Tcl/Tk - LabVIEW combination to be very effective.

Link to comment

Thanks all for the advice with this topic.

Michael - Your little piece of advice was helpful in that one of our s/w developers was taking a look at what you had suggested. That prompted him to inform me about a Linux utility called Netcat. This utility allows you to read and write data across network connections. This seems to be working fine. Again thanks for the help and fast response.

Link to comment

Glad to have helped. And thank you for letting me (us) know about Netcat, which I was not aware of. We just did everything in Tcl. It is always nice to know of prewritten utilities. Of course if I had brought it up in the right way I'm sure one of the linux gurus at the telescope probably knew about Netcat.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.