LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to call executable(EXE), then show the results on EXE only, not on the labview front panel ?

Dear friends, 

 

Please check the attached exe file (in Zip).  This executable file is very simple, give a number, then + 100000, then print out the result.  E.g if x =2, then 2 + 100000 = 100002.  

In the attached vi, I did this:  the order of the iteration of the while loop will gives to the test.exe, then result of test.exe will be shown on labview of "standard output".  

My question:1.  is there a way, I can show the result just on the exe file? It's ok to open multiple exe window.   e.g. in other words, lets say there are 5 iterations, then I will see 5 test.exe windows to show the different result depends on the input of the order of iteration.   

2. my test.exe just needs one input.  Lets say I need 2 inputs now to do x+y=c, c is output.  what should i do to the "stander input"?  

Thank you !!!!!

1.png

Download All
0 Kudos
Message 1 of 9
(4,495 Views)

The way you call the exe is sequential, since you use a while loop.

 

If you call System Exec 5 times in parallel, the exe will be called 5 times in parallel.

 

If you need a while loop to do it, you need to dynamically call a reentrant VI that calls System Exec.

 

If you know in advance how many iterations you have and the inputs are known, you can also use a parallelized for loop (right click, configure iteration parallelism, wire iterations to P and N).

 

If the executable is a LabVIEW executable, there might be a problem (not sure if there is). LabVIEW executables are designed to only start one instance. You might need to add "allowmultipleinstances=True" to the ini of the executable.

 

Not sure if what you want is a good idea... Why not let the exe do the calculation and let LabVIEW to the displaying? Seems a lot cleaner to me. Or obviously let LabVIEW add 100000 to x, but I hope it's just a placeholder.

0 Kudos
Message 2 of 9
(4,448 Views)

Thanks for your answer.

1. the test.exe is just a holder. The real exe will be much bigger, there are a lot of things will be displayed on the exe. That's why it's very bad to let the labview to do the display.  

2. I am not talking about how to call exe parallel.  I am asking, if there are 2 inputs I need to give to exe by using system exec,  could you show me how to do that?   

3.Let's say there are only 5 iterations. 

0 Kudos
Message 3 of 9
(4,426 Views)

@sunson29 wrote:

 

2. I am not talking about how to call exe parallel.  I am asking, if there are 2 inputs I need to give to exe by using system exec,  could you show me how to do that?   


I did not get that at all from your original question.

 

The only way to do that is to convert the inputs to string. The exe should then parse the command line to get the strings and convert them to values. Pretty much the same as one parameter, only parsing the string is more elaborate.

 

If the exe is a LabVIEW exe, you might consider making it a .dll instead (you can still make an exe for users to use). The dll function can support multiple inputs and outputs. To\From string conversion would not be needed anymore.

 

I have no experience with LabVIEW .net assemblies, but that would also be an option. Benefit would be that the interface would be defined by the dll, so it's easier to call.

0 Kudos
Message 4 of 9
(4,404 Views)

Thanks though

0 Kudos
Message 5 of 9
(4,381 Views)

The most common way to send Parameters to an exe is through Parameters.

"cmd /c copy file1.txt file2.txt"

The 2 files are Parameters, 'copy' and the rest are parameters to cmd.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 9
(4,343 Views)

Hmm. I think you were answering my question.  But I am not very follow here. 

Lets say, my EXE will take x, and y.  then output x+y.  

My question is how to give x and y to EXE by using labview  ??  

 

I am not  very following the meaning of "copy" and "file1.txt".   

0 Kudos
Message 7 of 9
(4,314 Views)

It depends...

Please tell us more about your exe.

I can't enumerate all methods for you.

 

George Zou
0 Kudos
Message 8 of 9
(4,296 Views)

Use an event structure - your UI should give fields for the inputs, and an 'execute' button that executes the system exec call. In your event structure, put the code that is in your while loop to call the system exec on the value change event of the execute button. Then, you will only call your exe when you press the button. Is that what you are looking for?

0 Kudos
Message 9 of 9
(4,292 Views)