04-09-2007 02:11 PM
04-09-2007 02:34 PM
04-09-2007 02:38 PM
I just compiled a application using 8.0 today with the run on opened under the buildscript to use a value of false and have no issues. The exe opens under an non run state and waits for the run arrow. I am pretty sure I have done this with the app builder in 7.1 and 7.1 I dont remember about prior to 7.0 (I havent used >7.0 in a few years and removed 4.0 5.0 6.0 and 6.1 from my machine so I cant verify this).
Paul
04-09-2007 02:39 PM
Oops 8.2. I can check on this later. Is there a bug in 8.2 app builder.
Paul
04-10-2007 07:10 AM
04-17-2007 10:07 AM
04-17-2007 01:39 PM
Here is a solution NI gave me.
You can create a case structure around the whole block diagram of the application.
1. Create a while loop around that case structure.
2. Wire a True constant to the stop terminal so the while loop only runs
once.
3. Create an uninitialized boolean shift register on the while loop.
4. Wire the left shift register to the input of the case structure (making
sure the customer's code is in the True case) and wire a True constant to
the right shift register.
The VI will run for a split second as soon as the exe is launched, but noneof the customer's code will be executed. Every time after that, the exe will run as expected when the user presses the run arrow.
07-08-2009 06:33 AM
Hi,
I am having the same problem; my .exe starts running at startup even though the "Run when opened" checkbox is unchecked. I did not follow the buildscript tip. What is this and how do I find and change it?
I am building a controller that will write to and read from a programmable power supply. I was really looking for a way to add a "Start measurement" button in the VI so that my measurements would not start until this was pressed, even though the VI was running. However, I have not figured out a way to do this yet, does anyone have any suggestions?
Thanks!
Clara
07-08-2009 08:15 PM
Clara –
When I asked this question almost 2 years ago, I knew ways to make things in the program not run until a button was selected – I was more just being lazy and asking the folks at NI “you have this button, so why doesn’t it work?” because it would have saved me a bit of time.
From a programming and user standpoint, it is better to have the program start running when the .exe is selected and then have your program/user control when particular portions of code (functions) are enabled. One simple way to achieve this is to place the code (your measurement code) into one case of a case structure with two cases (true and false). Then wire a button (your “Start Measurement” button) to the input of the case statement. As the program is running, the button can be pressed once to enable the measurements, and then pressed again to disable the measurements.
Another way is to make two while loops. In the first while loop, place a button (your “Start Measurement” button) so that the program will remain in the first while loop until the button is pressed. Place the code (your measurement code) into the second while loop. Make sure there is a wire connecting the two loops so the second loop will not run until the first loop is stopped with the button. The second while loop can be stopped any way you wish (including the “Start Measurement” button).
Brian McLean also suggested a good approch to this in an earlier post in this thread if you didn't already see it:
"Here is a solution NI gave me.
You can create a case structure around the whole block diagram of the application.
1. Create a while loop around that case structure.
2. Wire a True constant to the stop terminal so the while loop only runs
once.
3. Create an uninitialized boolean shift register on the while loop.
4. Wire the left shift register to the input of the case structure (making
sure the customer's code is in the True case) and wire a True constant to
the right shift register.
The VI will run for a split second as soon as the exe is launched, but noneof the customer's code will be executed. Every time after that, the exe will run as expected when the user presses the run arrow."
Keep in mind that there are probably a million other ways to do this, but the main idea is to somehow isolate the code you want to turn on/off, and then figure a way to control its activation/deactivation.
- Jim07-09-2009 04:43 PM
Hi Clara,
If an acceptable solution has been posted, please go ahead and give the poster credit by marking it as so and giving out kudos.
Thanks!