LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

add file to executable

I'm trying to build an executable that will look up an external file to get input parameters. In the vi that will be made into the executable I place the external file name in a path relative the the vi path. When I build the executable and run it, it can't find the file. How do I rectify this?

 

I tried putting the file into always included and the support directory the same as that where the executable is, but still not working.

 

Regards,

 

Leeser

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

I tried the solutionas suggested but it only partly worked.

 

yes it obtained the relative path of the file I wanted. However, this file contains details for an absolute path eg

...

inputs_folder,C:\input_data

....

 

So a routine (subvi) scans the text file and finds "inputs folder" and returns "C:\input_data" and turns it into a base path. This is then combined with the build_path vi and a filename to get an absolute path to a specific file. However, Erro7 occurs as it cannot find the file. It works in the development version but not in the executable version.

 

I want to have absolute paths as the directory structure is not known beforehand and so it can be changed at will.

 

Anyone any suggestions?

 

Regards,

 

Leeser

0 Kudos
Message 3 of 9
(3,666 Views)

to do this you either:

must install a directory at the designated absolute path or

place some code in your application the creates the file and path structure if it does not exist<< the file exists function is a good thing to use to see if you need to call the sub-vi that writes the file with default dataSmiley Wink

 

Optionally there is nothing wrong with using the default data directory  C:\program data(\Myapp\)


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 9
(3,660 Views)

Thanks for your suggestion but the directory is already existing and so are the specific files in that directory.

 

 

The executable simply has to go to the said directory and file and read it (spreadsheet file) and then populate a control...

 

I am at a loss...it works in the development version but not in the executable....

0 Kudos
Message 5 of 9
(3,657 Views)

Can you post your code, or at the very least a screenshot? Please post screenshots in PNG/JPEG/GIF format. DO NOT POST BITMAPS. Remember: renaming a .bmp file to .png does NOT magically change its format.

0 Kudos
Message 6 of 9
(3,655 Views)

Hi,

 

It's a very complex vi using JKI State Machine Template so I have attached what I think is relevant snippets...

 

core_stripped.png

This shows the initial correction as suggester by Mercurio and which works to get the relative reference path correct. This allows me to read in the data from a text file shown in the next image..

get_parameters.png

 

so the stripped path and build path with the name of the text file is fed into the "get" vi and it returns the text from the text file into the cluster on the right. In the development version the folders.wafer-data absolute path is correct and so is Motor data.surface_data text value. These are then used at a later stage as in the next snippet

 

file_read.png

 It works in the development verison but not the executable.

 

I don't want to hardwire the absolute path into the coding but want it accessible and changeable external through the text file.

 

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

Ok, I made a simple vi of the basic process and have attached it here along with the text file it scans to get the paths. The previous figures may not have been clear...

 

It works both in the development and the executable version. This means that in my complex vi I have made an error somewhere. But as it works in the development version but not the executable version this would imply that my coding is not horribly wrong.

 

Is there any way of stepping through the executable like in highlight mode? Maybe that way I can find the error.

 

Leeser

Download All
0 Kudos
Message 8 of 9
(3,625 Views)

Got off my ass and did a quick search for "debugging executables" and got the following, sorry if I wasted anyone's time...

 

 

http://digital.ni.com/public.nsf/allkb/3087D91EEADBAF3D862571D1004AF192?OpenDocument

http://digital.ni.com/public.nsf/allkb/8DA679805915DE40862572D5007B2F70?OpenDocument

 

0 Kudos
Message 9 of 9
(3,621 Views)