11-25-2019 04:00 PM
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?
Solved! Go to Solution.
11-25-2019 04:14 PM
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!
11-25-2019 09:22 PM
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.
11-25-2019 09:58 PM - edited 11-25-2019 09:59 PM
You can use a Call and Forget node. See below and attached. Just use your Main VI instead of the TDMS Viewer.
mcduff
EDIT: Forgot to mention all of this belongs in another VI, not your Main VI. You use this to call your Main VI.
11-26-2019 06:39 AM
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.
11-26-2019 06:40 AM
Drop a property node.
Select: Application -> Command Line Arguments
11-26-2019 07:03 AM
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.
11-26-2019 07:04 AM
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.
11-26-2019 09:24 AM - edited 11-26-2019 09:39 AM
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
11-26-2019 11:05 AM
@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...