LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

create new folders

Help me please!
I want to create some folders, and after write file to it.
Structire-> folder1(folder2(folder3(file))).
I do -> "Build Path" - "New Directory" - "Build Path" - "New Directory" -..."Write characters to file".
But it work only in single VI. If I build exe it doesn't work (Error NI-488), folders are not created and data are not written to a file.
0 Kudos
Message 1 of 5
(3,365 Views)
I have overlooked to tell! LabVIEW 6, Win98!
0 Kudos
Message 2 of 5
(3,363 Views)
Hi,

before you build the application add a strip path in the beginning because for some reason the executable always adds itself to the path when you run the application path function.
0 Kudos
Message 3 of 5
(3,360 Views)
Hi,

Please refer to the following knowledge Base for more information on why you need to use a Strip Path function when working with executable.
http://digital.ni.com/public.nsf/websearch/FD7DE8BC8FFC256C862565F4006BE363?OpenDocument

Ankita
0 Kudos
Message 4 of 5
(3,335 Views)
Think for a minute about how paths work. A path is exactly where on the file system a given file exists.

The most versatile way to specify a path is relative to the VI that needs it (using THIS VI'S PATH). This allows you to move the VI or app and the directories that go with it as a whole, and the thing will still work.

If you're doing that, you need to understand what THIS VI'S PATH returns. It returns the full path to the VI that called it. There are three possibilities:
1... SomeDisk:SomeFolder:SomeVI <--- This is returned if called from a stand-alone VI file.

2... SomeDisk:SomeFolder:SomeLLB:SomeVI <--- This is returned if called from a VI within a library (LLB) file.

3... SomeDisk:SomeFolder:SomeApp:SomeVI <--- This is returned if called from a VI within an app (executable) file.

Notice that for stand-alone VIs, you strip path ONCE to get the enclosing folder (SomeDisk:SomeFolder).
But for LLBs or APPs, you strip path TWICE to get the enclosing folder (SomeDisk:SomeFolder).

For this reason, I have adopted the policy to never use stand-alone VI files. I always use files in libraries. Then the code doesn't have to change.

HINT: At startup, I find the root folder with the THIS VI'S PATH function, stripping appropriately. As part of this, I search for ".llb" in the container's name, and remember whether I found it or not. Whn the user chooses QUIT, I use the EXIT LABVIEW function, with the inverse of the FOUND IN LIBRARY flag, I set on startup. That means that the APP will completely close, not leaving a window around, but if you're in the LabVIEW dev. system, it won't exit LabVIEW.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 5 of 5
(3,317 Views)