09-23-2011 12:24 AM
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,
09-23-2011 03:10 AM
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:
09-23-2011 10:55 PM
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.
09-24-2011 06:40 AM
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...