LabVIEW

cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

Question about application builder

Hello all
 
I have a question about building executables with the application builder. I am using Labview 8.0 professional development system.
I manage to create applications with installers and so on. But one thing I don't get to work:
My startup vi references to txt- and bmp files from which I load settings and pictures. This works well just to the point where I have built my application. Then the files which should be loaded can't be found which returns in an error.  I already tried to put the relevant files to "Dynamic Vi's and supported files", but that does not help. What can I do to handle this problem?
 
Thank you for any advice
 
Woodi
 
0 Kudos
Message 1 of 9
(4,268 Views)
Hello woodi,

this applies to different "path to vi" in development mode and executable.
In development mode you get something like "c:\program folder\my_vi.vi", in executable you get "c:\program folder\my_vi.exe\my_vi.vi". Did you notice the additional folder?
So you have to have different "Strip path"/"Build path" when referencing files/folders by hard-wired constants!

Have a better search in the forum, you will find many threads on this!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 9
(4,264 Views)
Hello Woodi,

This thing happens to 90% of LabVIEW developpers the first time they build their first app.

This is a path issue. When you build an exe, all you VIs are put inside of the exe so when you use "current vi path" + "strip path", the result is different if you are running VI or exe šŸ˜‰

Before you build, just add a strip path when you get your file path, or better use "directory/file info" to make sure your path is correct before you read/write your text file, if the path is a file path do one more strip path šŸ˜‰

Hope this helps

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 3 of 9
(4,262 Views)
Smiley Sad I was not fast enough ... Smiley Sad


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 4 of 9
(4,258 Views)

Hi to all

Thank you for your help. I guess I have not had a proper look at the discussion forums. Maybe I had not the right key words in mind, because I found some more topics as soon as the first reply of you came. However I managed to load my files. I was a bit confused about the things with "dynamic VIs and support files" from the application builder.

For others struggling with this problem:

I found this link:

http://digital.ni.com/public.nsf/allkb/686119C33C2C30C186256CA70081AC25

and this solution:

 

 

Greetings

 

Woodi

0 Kudos
Message 5 of 9
(4,251 Views)
Woodi,
 
If you are trying to determine whether or not a VI is in the LabVIEW development environment or a built executable.  An easier way to tell is to use the Application.Kind property and check if it is the Run Time System.  If so then the VI is in a built EXE (or DLL), else you are in the development environment.  This is the check we use in the VIs we develop in LabVIEW R&D.  See the attached VI.  Also if you are trying to get the path to the current EXE then you should use the Application.Directory property.  I'm going to ask that the KB you mention be updated.
 
Kennon
Message 6 of 9
(4,235 Views)
Kennon, doesn't that create a problem if the VI was in an LLB? If I remember correctly, that was the reason the OpenG VI uses a while loop - to make absolutely sure that it reached a directory before it returns.
 
Also, the App.Dir property does not tend to be very useful when running from inside LV as I would normally be interested in either the VI's directory or the EXE's directory.

___________________
Try to take over the world!
Message 7 of 9
(4,219 Views)

Hi Kennon,

thank you for your advice. Yes, I think this is even more elegant. I will use this method to distinguish wether a VI runs at development environment or as built executable.

Thanks!

Woodi

0 Kudos
Message 8 of 9
(4,176 Views)

Hi Kennon,

You wrote "you need to know where your VIs are and where they will end up"

This is one of the challenges I have to face when developing re-usable code. Since I do not know these answer at development time, I have found that the iterative strip path method ALWAYS works.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 9 of 9
(4,172 Views)