LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

add folder in standalone application

Hi,

Trying to read .rtf files in a standalone application. The files must be located in a folder called “Text”.  When I run in LabVIEW, it works really well but when I try to make a standalone application doesn’t work. Is anybody who knows how can I do? Here is the .vi file and a zip Text folder (unzip the folder before you use it).

Than you,

Download All
0 Kudos
Message 1 of 4
(1,986 Views)

The path of the VI changes when build into an executable. It's just one of the caveats to be careful about when building an executable. There are two things that I would ask you to do:

  1. Put an indicator on the path wire to know what the difference in path setup is for when the VI runs in Dev and when it's deployed.
  2. Instead of using Current VIs Path.vi use Application Directory.vi. It was released in 2009 I believe.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 2 of 4
(1,977 Views)

Hi,

 

When you create an EXE your path changes.

 

i.e Suppose

 

1) your code directory is "C:/MyCode" 

2) Text Files are in "C:/MyCode/Text" directory.

3) Your Application (EXE File) directory is "C:/MyApp"

 

In code your "hello" file path will be "C:\MyCode\Text\hello.rtf" and for application this path will be "C:\MyCode\MyApp\Application.exe\Text\hello.rtf"

This is why your code is not working while in executable.

 

And the solution is you have to strip your path to your main directory. Here in this case it is "MyCode" directory and then append remaining path.

PBP
Labview 6.1 - 2019
0 Kudos
Message 3 of 4
(1,967 Views)

If you have access to the application directory function mentioned, that will work in the runtime but might cause problems in the development environment (because it will be pointing to where LV is installed).

 

Another idea would be to create a subvi that reads the Application:Kind property to determine what the execution environment the code is running in. Then if you are running as a standalone application call application directory to get your starting path, but if you are in the development world, use your current technique.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 4
(1,959 Views)