02-21-2011 08:19 AM
I was just wondering if anyone knows how to get LabVIEW to update a text indicator with the information from a Command Prompt in real-time? So like if you ping the IP it'll show it pinging and not just wait til the end to update it. I'm trying to have a batch file that processes code show on screen so the user can see that it is running and isn't frozen. When I ran the test originally it had a cmd window pop up and show that the information was passing. Since I opened the program with the system exec, it no longer shows anything so I was thinking that if it showed in in a text indicator then the problem could be solved.
Thanks,
Derek
Solved! Go to Solution.
02-21-2011 08:29 AM
One way is to use your shell's piping comand and redirect the output to a file and then read the file in from LabVIEW and update your display from that.
02-21-2011 08:35 AM
How could I go about doing that? Sorry, I'm pretty new to LabVIEW, I have only really used it in a class I had in college. How do you code the VI to redirect the output of a command prompt window to a file? Also, I know how to have LabVIEW read a file but doesn't it do that once instead of keeping it updated with all information that it keeps passing?
02-21-2011 09:11 AM
First you have to get your operating system to pipe the output from the ping command to a file. That is not realy a LabVIEW function.
You need to try it out first by using the command prompt window until it works. Then use that command that works in the command prompt window and pass that to command exec in LabVIEW.
Yes, you will need to poll the file for new output. You could check file size to see if new data is there. Or just keep reading the file over and over on a 200ms delay until the ping is done.
02-21-2011 09:38 AM
I got a command to work in the cmd but I can't seem to get it to work in my test VI. I have attached a picture of my VI and the VI itself.
When I do it in the cmd it creates a new file and writes it to the file perfectly. When I try to recreate the code on my test VI it says that it can't find the host and if I add spaces it says that the > redirect command is a bad parameter. Do you have any suggestions to correct this?
Thanks for all of your help!
02-21-2011 11:30 AM
From the help for the System Exec VI
(Windows) To use a DOS command, insert cmd /c before the command.
So try passing this to System Exec VI
cmd /c ping 172.18.81.54>"C:\temp.txt"
Change the IP for your needs.
The quotes around the file path is needed if you have any spaces in the file path.
Now when you do this you will not get anything back from the stardard output, because you have redirected it.
The results will have to be read from the file!
02-21-2011 11:53 AM - edited 02-21-2011 11:54 AM
Thank you very much. I got it to work now. The problem is that I completely forgot about the /c command. that had to be the difference because that is the only change that I made and then it worked.
I only had the standard output there for a troubleshooting aid.
Thank you for all of your help!
05-27-2016 06:19 AM
I am sending command to Linux RT terminal through Labview. I tried mkdir command. it works fine. But when I tried another command, It doesnt work. I tried to calibrate the touchscreen monitor using this command.
/usr/bin/xinput set-int-prop "3M 3M USB Touchscreen - EX II" "Evdev Axis Calibration" 32 14208 2141 13868 2763
But its works in Linux Terminal.
05-27-2016 01:47 PM
@Reji.V wrote:I am sending command to Linux RT terminal through Labview. I tried mkdir command. it works fine. But when I tried another command, It doesnt work. I tried to calibrate the touchscreen monitor using this command.
/usr/bin/xinput set-int-prop "3M 3M USB Touchscreen - EX II" "Evdev Axis Calibration" 32 14208 2141 13868 2763
But its works in Linux Terminal.
This has absolutely no relation to the orignal post. Make your own.