LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

pass parameters to main VI

Solved!
Go to solution

The production tests are done with LabVIEW in development mode running a VI instead of running a test program's executable. Very bad practice I know but out of my control.

 

I want to create a shortcut that calls the main VI with an input parameter such as parameter1:yes

 

Is this possible?

 

 

 

0 Kudos
Message 1 of 10
(2,770 Views)

You can create another VI that calls your main VI. You can set your caller VI to "run when opened" so that once the short-cut is clicked it will start running. I agree, this is not ideal for a production environment!

0 Kudos
Message 2 of 10
(2,755 Views)

I can't figure out how to include the parameter in the shortcut and how the VI will access it even if I do as you say.

 

0 Kudos
Message 3 of 10
(2,714 Views)
Solution
Accepted by topic author psuedonym

You can use a Call and Forget node. See below and attached. Just use your Main VI instead of the TDMS Viewer.

 

snip.png

 

mcduff

 

EDIT: Forgot to mention all of this belongs in another VI, not your Main VI. You use this to call your Main VI.

Message 4 of 10
(2,709 Views)

You could also preset the parameters from a file (ini, cfg, xml, for example). Since you didn't attach your code I don't know your architecture. If you have a state machine this can easily be done in an initialization state. Otherwise just make sure you read the file and update the controls before you start reading the controls.

0 Kudos
Message 5 of 10
(2,686 Views)

Drop a property node.

Select: Application -> Command Line Arguments

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 6 of 10
(2,685 Views)
You could also preset the parameters from a file (ini, cfg, xml, for example).

 

Yes, but then I would have to change that file every time I wanted to change the parameter.

0 Kudos
Message 7 of 10
(2,676 Views)
Drop a property node.
Select: Application -> Command Line Arguments

I will give that a try, but I thought that only works when the VI is made into an executable.

0 Kudos
Message 8 of 10
(2,675 Views)

Besides the solution provide by mcduff, passing parameters to the main VI is possible to do by launching the VI from the command prompt as mentioned in https://zone.ni.com/reference/en-XX/help/371361R-01/lvhowto/launchingvifromcommandline/

That method requires the user to open a Command Prompt window and then typing a long command line.

 

It is possible to create a shortcut which launches the Command Prompt window and then launch main VI with input parameter .

The shortcut would have a Target of C:\Windows\System32\cmd.exe /c "C:\Program Files (x86)\National Instruments\LabVIEW 2015\LabVIEW.exe" the_main_v040.vi -- /parameter1:yes

 

 

 

0 Kudos
Message 9 of 10
(2,648 Views)

@psuedonym wrote:

The production tests are done with LabVIEW in development mode running a VI instead of running a test program's executable. Very bad practice I know but out of my control.

 

I want to create a shortcut that calls the main VI with an input parameter such as parameter1:yes

 

Is this possible?

 

 

 


It may be "bad practice" now, but there was a time when LabVIEW did not support building executables...

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 10
(2,621 Views)