04-13-2017 05:24 PM
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!
Solved! Go to Solution.
04-13-2017 05:32 PM
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.
04-13-2017 07:36 PM
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.
04-14-2017 02:45 AM
@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. 🙂
04-14-2017 03:41 AM
04-14-2017 11:03 AM
@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!
04-14-2017 12:45 PM - edited 04-14-2017 01:03 PM
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.
04-14-2017 02:56 PM
@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.
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...
04-14-2017 04:41 PM
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?
04-14-2017 09:01 PM
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. 🙂