LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 1 occurred at Write to Text File - Installer with Application Builder

Solved!
Go to solution

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 

0 Kudos
Message 1 of 11
(4,562 Views)

Show us some code.

 

My guess is that you used the Current VI's Path to get the needed directory.  Use Application Folder instead.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 11
(4,553 Views)

Conversion Code.PNG

Here is a sample of the code, I think this section is what is causing the error.

0 Kudos
Message 3 of 11
(4,541 Views)

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

0 Kudos
Message 4 of 11
(4,539 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 11
(4,534 Views)

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?

0 Kudos
Message 6 of 11
(4,525 Views)

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. 

0 Kudos
Message 7 of 11
(4,502 Views)

 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!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 11
(4,492 Views)

@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?

 

0 Kudos
Message 9 of 11
(4,482 Views)
Solution
Accepted by topic author Scott04

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?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 11
(4,477 Views)