04-01-2015 10:56 AM
I've wrote an installer using the Application Builder to install the Run-Time Engine that allows any computer without LabVIEW to run a .exe program. The installer runs and installs the run-item engine and then also a .exe VI. When it is done installing, the .exe VI opens automatically.
An error pops up when the .exe opens up and says "Error 1 occurred at Write to Text File". If the user clicks out of the error he can run the program no problem, it converts file formats in a .lvm file. It automatically generates a new file name and saves the file to the same directory but with a different name.
Why did this only happen when first opening up? Does the program try to run when it automatically opens up? Is there a residual file path left in the program that trys to run first before the user puts his own file path into the program?
I'm semi new to labVIEW (a few months) and just can't see anything that would create this error at the start of the program.
Thank you
Solved! Go to Solution.
04-01-2015 11:09 AM
Show us some code.
My guess is that you used the Current VI's Path to get the needed directory. Use Application Folder instead.
04-01-2015 11:28 AM
Here is a sample of the code, I think this section is what is causing the error.
04-01-2015 11:31 AM
I attached a picture of the code. What do you mean by using the Current VI's Path and using the Application Folder instead.
When the user clicks run it should obtain a file from the directory he chooses, create the new name from that same file name, and save it to that same location with the different name.
Is it possible that when the .exe first opens it is trying to run?
Thanks
04-01-2015 11:38 AM
Scott04 wrote:
Is it possible that when the .exe first opens it is trying to run?
It is running. That is what executables do, they run your code. Would you expect to have to hit the Run button on Word or Excel? Expect the same for your LabVIEW programs. Use Event Structures to detect the user selecting a directory and then do your thing on that directory.
04-01-2015 11:45 AM
So the user doesn't have to click run first before it runs? How come when opening the .exe on my own computer it doesn't run first before I click run?
04-01-2015 01:21 PM
Is there any way to get an executable to run when the user pushes a run button, not when it is opened?
Any help would be greatly appreciated, I know i may have to use some "cheat code" to make this possible, from what I've read this is something that cannot be changed in the settings for an executable.
04-01-2015 01:46 PM - edited 04-01-2015 01:48 PM
Scott,
how does other software handle this problem?
An EXE starts running and usually waits on USER INPUT!
So you need to program your own VI to do the same: wait for user input before anything else is called…
As Tim already said: It is expected behaviour for executables to automatically RUN after calling them!
04-01-2015 02:02 PM
@GerdW wrote:
Scott,
So you need to program your own VI to do the same: wait for user input before anything else is called…
Thank you for this!
Would an easy way to do this be to put my entire code in a case statement with a bollean switch wired to the decision terminal and have the default case be false. That way when the user clicks the bollean it will run my code inside the case statement?
04-01-2015 02:08 PM
Hi Scott,
well, you could mock up a small VI and turn on Highlight-Debugging to test your idea!
THINK DATAFLOW!!!
How should a boolean input WAIT for user action? It will be read according to DATAFLOW!
What about that small pseudocode:
REPEAT wait(50ms) UNTIL button pressed
Or what about an event structure waiting for user action?