LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

creating or reading text based files in compiled vi (.exe)

Solved!
Go to solution

I've made my .vi which contains functionality to read/write settings and to write logfiles. All is going well until i want to create an executable to distribute to colleagues who may not have labview development. When running the .exe, it seems i cannot create or read .txt or .ini files. Any idea how i can import the text read/write/file open functions to my .exe? 

0 Kudos
Message 1 of 9
(3,474 Views)

In order to distribute your labVIEW application as a .exe file, your collegues must have a labVIEW runtime engine. Or you can create an installer of your application and distribute. 



0 Kudos
Message 2 of 9
(3,467 Views)

The real question here is: How are you making the paths for the files?  If you are making paths based on the VI location, that is your problem.  As always, being able to see the actual code would help a lot here.


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 3 of 9
(3,458 Views)

Hello,

 

I'm well aware of this.

The real issue is that on my same laptop, the .exe does not work with the read/write as where the .vi is fully working.

0 Kudos
Message 4 of 9
(3,445 Views)

The paths are made relatively to the current folder with "current VI's path', so maybe you are pointing me in the good direction by telling me that i need to use some other kind of method to have the current folder? An absolute path is less convenient while distributing the .exe, any suggestions to do it on another way?

0 Kudos
Message 5 of 9
(3,440 Views)
Solution
Accepted by topic author jboydens

You are actually trying to create or read a file INSIDE of the executable.  Obviously, that will not work.  Instead, use the Application Directory.  It returns the folder that contains your project file (when in the LabVIEW environment) or the folder of the executable (when in the RunTime Engine).

 

So in your given example, you would just need the Application Directory and Build Path to get the location of your settings.ini file.


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 6 of 9
(3,415 Views)

This is a followup to Crossrulz's suggestion.  I needed to access a DLL that was stored in the Data folder that the Build process creates, but that, during Development, was stored in a folder within my Project.  This VI detects whether it has been called from the Run-Time or Development System and returns the appropriate path.

PiC DLL.png

Bob Schor

0 Kudos
Message 7 of 9
(3,407 Views)

@crossrulz,

thanks, this works fine in the .exe when compiled

 

@Bob_Schor,

this seems a interesting solution to catch differences you want between development mode and distributable, thanks for the tip!

 

Joachim

0 Kudos
Message 8 of 9
(3,395 Views)

Bob,

 

You should really look into Conditional Diagram Disable Structures.  They are a little more efficient and you would not need that property node.


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 9 of 9
(3,385 Views)