11-17-2010 01:13 AM
Hello All,
I am developing a VI which would Write a string to a third party console application (running on DOS) and then read the data from this console back into LabVIEW. I think this is possible by using the Windows API, but I would like to know which would be the best method to implement this.
Thanks
FraggerFox
Solved! Go to Solution.
11-18-2010 08:23 AM
Hmmm. Little unsure what you mean here. Are you trying to execute a command line statement and then read back the response? Couldn't you just use System Exec for this:
http://zone.ni.com/reference/en-XX/help/371361G-01/glang/system_exec/
Or perhaps you could store your commands in a batch file, then run the batch and output the results to a text file. This is done like this:
batch_file.bat >output.txt
11-18-2010 08:42 AM
DOS is an operating sytem. It's not Windows (though there are remnants of DOS within the source code of Windows). So, to say something is running on DOS implies it's running on a different computer. Is this the case? There's the command window in Windows. Is that what you are referring to? So, is this a command-line application? If so, yes, there is a way to use the Windows API to capture the contents of the command line window and to paste contents into it. I showed an example in this thread: Re: URGENT!!! How we read stdout directly?
11-18-2010 09:13 AM
Just rewire the error clusters in the broken VI in smercurio's example, which is explained in the example - caused by 8.2 ver bug.
11-18-2010 09:31 AM - edited 11-18-2010 09:32 AM
I just thought - if the OP's application is truly a console ap, wouldn't it report back to the console? And all that would be required is something like this? (where "mem" = the 3rd party command line with all arguments).
11-18-2010 11:24 PM - edited 11-18-2010 11:26 PM
@smercurio_fc
I think the example in this link would solve 80% of my problem. I would need to make some changes here before finally using it.
I used some different kernel32 commands before posting this here, in which I would need to use the FreeConsole() function, which I didn't want.
Thanks! 🙂