LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Real-time updating with text indicator from system exec

Solved!
Go to solution

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

0 Kudos
Message 1 of 9
(5,216 Views)

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.

Omar
0 Kudos
Message 2 of 9
(5,208 Views)

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?

0 Kudos
Message 3 of 9
(5,203 Views)

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.

Omar
0 Kudos
Message 4 of 9
(5,192 Views)

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!

Download All
0 Kudos
Message 5 of 9
(5,187 Views)
Solution
Accepted by topic author STigmata08

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!

Omar
Message 6 of 9
(5,174 Views)

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!

0 Kudos
Message 7 of 9
(5,166 Views)

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.

0 Kudos
Message 8 of 9
(4,275 Views)

@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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 9
(4,265 Views)