LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Any ideas for a CLI VI? (I don't even know how to explain it very well.)

Solved!
Go to solution

Hi, Everyone:

 

I'm stumped.  I'd like to write a VI that would make executing a single command line command "simple".  Let's say I wanted to make one for the "ping" command.  (Windows.)  I'd like to use controls for the parameters to eliminate operator error, so I'd make some kind of a control for -t, for instance, and another for -n <number>, and so on.  Eventually, it all gets boiled down to a command line, of course.  I realize this may, in fact, be unfeasible, and a single string control for the parameters is the best way to do it.

 

Still, has anyone attempted something like this before?

 

Thanks!

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 1 of 14
(3,808 Views)

I have issues like what's the best way to make a parameter "optional".  For instance, the -n has a number associated with it, but if I make it a numeric control, it always has to be there.  Now for that one, I could code it so if the user entered -1, the option would not be included, but what if it's a port, for instance?  If I use a U16, I automatically make it impossible to enter an invalid port number, but I also make it impossible to to enter something that signals the code to ignore the parameter.  If I make it a string or some other numeric type, then it's possible to enter bad data.

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 2 of 14
(3,796 Views)
Solution
Accepted by topic author billko

Although I don't think this is a generic solution, which is maybe what you wanted, could you consider checkboxes for each command option, and only use the values (limited by the control type, range coercion, etc) that have their 'Use These Parameters' ticked?

 

I've attached a very crude VI which shows what I mean, but you can't run it minimized if you want to have -t as a flag. I guess you can probably work out a way to pass the interrupt signal from LabVIEW after execution, but I don't know how without researching it.


GCentral
0 Kudos
Message 3 of 14
(3,765 Views)

@cbutcher wrote:

Although I don't think this is a generic solution, which is maybe what you wanted, could you consider checkboxes for each command option, and only use the values (limited by the control type, range coercion, etc) that have their 'Use These Parameters' ticked?

 

I've attached a very crude VI which shows what I mean, but you can't run it minimized if you want to have -t as a flag. I guess you can probably work out a way to pass the interrupt signal from LabVIEW after execution, but I don't know how without researching it.


I can't see your code because I don't have LV 2016 at home, but it appears that you understand exactly what I need.  And I see we have arrived at the same solution through convergent evolution.  This seems like the leading solution, but it is a bit clunky if you have a lot of switches.  It may indeed need to be a cluster of Boolean/Data clusters.  At least the format for each will be similar, giving the user a consistent experience.

 

We have some very innovative folks here and have way more experience than me.  Let's give them a chance to chime in.  🙂

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 4 of 14
(3,745 Views)

I can save it to a different version if you want?


GCentral
0 Kudos
Message 5 of 14
(3,737 Views)

@cbutcher wrote:

I can save it to a different version if you want?


It's okay - I got to work and looked at it.  Since no one had any comments in between, I have accepted your solution as the only sane way to approach this issue.

 

Thanks!

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 6 of 14
(3,717 Views)
Solution
Accepted by topic author billko

You simply build a command line with strings write it to a Batch file and use the systemexec.vi to launch it the batch file.

You might not have to do the batch file thing, I need to run a couple more commands first to be able to kill the running console windows.

 

Here is an example program I wrote to launch Iperf for throughput bandwidth testing, with many options including an option to redirect it's output to Mtee for saving to a file.

 

Ipe.PNG

 Ipe2.PNG

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 14
(3,705 Views)

@RTSLVU wrote:

You simply build a command line with strings write it to a Batch file and use the systemexec.vi to launch it the batch file.

You might not have to do the batch file thing, I need to run a couple more commands first to be able to kill the running console windows.

 

Here is an example program I wrote to launch Iperf for throughput bandwidth testing, with many options including an option to redirect it's output to Mtee for saving to a file.

 

Ipe.PNG

 Ipe2.PNG

 


That's pretty funny, because iperf (v. 3, udp bugs and all) is what I was intending on making.  I guess my questions are what happens when you think about building it from the bottom up instead of the top down...

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 8 of 14
(3,685 Views)

billko wrote: That's pretty funny, because iperf (v. 3, udp bugs and all) is what I was intending on making.  I guess my questions are what happens when you think about building it from the bottom up instead of the top down...

LOL There are no new ideas ...

 

Anyway would you like my project as a starting point? What version of LabVIEW are you using?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 9 of 14
(3,670 Views)

I didn't want to ask, but... yes that would be really nice of you to share it with me.  The most convenient version would be LV 2015 because that's what I am using for this project of mine.  🙂

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 10 of 14
(3,661 Views)