LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

File locations from LabView or AppBuilder

Hi, I've tried looking this up on DejaNews and at the NI knowledge
base but can't find the solution.

I have decided to add in a config file so my application can remember
the last directory use. When I run in LabView the file is created an
writen to properly. When I use the Application Builder and run the
program the file is not created because it can't be found.

I recall sometime back someone talking about this and what you have to
do if you use Application Builder and file paths. Could someone
please explain it again.

Thank yoy.

Regards,

Steve Drake
0 Kudos
Message 1 of 8
(3,510 Views)
Steve Drake wrote:

> Hi, I've tried looking this up on DejaNews and at the NI knowledge
> base but can't find the solution.
>
> I have decided to add in a config file so my application can remember
> the last directory use. When I run in LabView the file is created an
> writen to properly. When I use the Application Builder and run the
> program the file is not created because it can't be found.
>
> I recall sometime back someone talking about this and what you have to
> do if you use Application Builder and file paths. Could someone
> please explain it again.
>
> Thank yoy.
>
> Regards,
>
> Steve Drake

I am not sure but I believe that the directory is one level higher
(or is that deeper) in an app as opposed to the development.

Kevin
0 Kudos
Message 2 of 8
(3,510 Views)
The "Current VI's Path" function adds the executable to the path as if it is
a sub-directory. Whenever I use this function I also use a sub-VI that is
setup to recognize if the VI is in an executable or not. If it is I strip
one extra level off the path. You can find out if it is an executable by
searching for a .exe in the path string.

Best Regards,

Neal Pederson, President, VI Control Systems
1923 Mendius Lane, Los Alamos, NM 87544
TEL: (505) 662-1461, FAX: (603) 388-4969
np@vicsys.com, www.vicsys.com

Steve Drake wrote in message
news:8lqois4s5b2i0dn8iluuo07gm0fihdl8bs@4ax.com...
> Hi, I've tried looking this up on DejaNews and at the NI knowledge
> base but can't find the solution.
>
> I have decided to add in a config file so my ap
plication can remember
> the last directory use. When I run in LabView the file is created an
> writen to properly. When I use the Application Builder and run the
> program the file is not created because it can't be found.
>
> I recall sometime back someone talking about this and what you have to
> do if you use Application Builder and file paths. Could someone
> please explain it again.
>
> Thank yoy.
>
> Regards,
>
> Steve Drake
0 Kudos
Message 3 of 8
(3,510 Views)
On Fri, 26 May 2000 07:28:45 -0600, "TNT News"
wrote:
Hi, I tried to write a subvi to strip off the executable name from
the path but I still can't get the .ini file I want to read. From
what you said do you have to leave on the xxx.exe on the end of the
file path for it to properly work?

Also did you work with a networked path? I can never get into the
last directory I'm always one directory up. Same problem as before?

I'm sure NI must know about these problems have you heard if they
are going to fix these problems, after all these are bugs no features.

Regards

Steve Drake


>The "Current VI's Path" function adds the executable to the path as if it is
>a sub-directory. Whenever I use this function I also use a sub-VI that is

>setup to recognize if the VI is in an executable or not. If it is I strip
>one extra level off the path. You can find out if it is an executable by
>searching for a .exe in the path string.
>
>Best Regards,
>
>Neal Pederson, President, VI Control Systems
>1923 Mendius Lane, Los Alamos, NM 87544
>TEL: (505) 662-1461, FAX: (603) 388-4969
>np@vicsys.com, www.vicsys.com
>
>Steve Drake wrote in message
>news:8lqois4s5b2i0dn8iluuo07gm0fihdl8bs@4ax.com...
>> Hi, I've tried looking this up on DejaNews and at the NI knowledge
>> base but can't find the solution.
>>
>> I have decided to add in a config file so my application can remember
>> the last directory use. When I run in LabView the file is created an
>> writen to properly. When I use the Application Builder and run the
>> program the file is not created because it can't be found.
>>
>> I recall sometime back someone talking about this and what you have to
>> do if you use Application Builder and file
paths. Could someone
>> please explain it again.
>>
>> Thank yoy.
>>
>> Regards,
>>
>> Steve Drake
>
0 Kudos
Message 4 of 8
(3,510 Views)
How do you build the ini path exactly? Is the VI located in the executable
or elsewhere?

Can you put an indicator somewhere to see exactly what path is generated in
the application?

The Open Config Data.vi should work for network path but a quick test
indicates
that the Read Key (Path).vi does not work for network path.
The path \\netpath\c is written in a ini file as //netpath/c and reads back
as the path
C:\:netpath\c

Steve Drake a �crit dans le message :
pch5jsc5j59globdes6ochj8g2mfrmnqpu@4ax.com...
> On Fri, 26 May 2000 07:28:45 -0600, "TNT News"
> wrote:
> Hi, I tried to write a subvi to strip off the executable name from
> the path but I still can't get the .ini file I want to read. From
> what you said do you have to leave on the xxx.exe on the end of the
> file path for it to properly work?
>
> Also did you work with a networked path? I can never get into the
> last directory I'm always one directory up. Same problem as before?
>
> I'm sure NI must know about these problems have you heard if they
> are going to fix these problems, after all these are bugs no features.
>
> Regards
>
> Steve Drake
>
>
> >The "Current VI's Path" function adds the executable to the path as if it
is
> >a sub-directory. Whenever I use this function I also use a sub-VI that
is
> >setup to recognize if the VI is in an executable or not. If it is I
strip
> >one extra level off the path. You can find out if it is an executable by
> >searching for a .exe in the path string.
> >
> >Best Regards,
> >
> >Neal Pederson, President, VI Control Systems
> >1923 Mendius Lane, Los Alamos, NM 87544
> >TEL: (505) 662-1461, FAX: (603) 388-4969
> >np@vicsys.com, www.vicsys.com
> >
> >Steve Drake wrote in message
> >news:8lqois4s5b2i0dn8iluuo07gm0fihdl8bs@4ax.com...
> >> Hi, I've tried looking this up on DejaNews and at the NI knowledge
> >> base but can't find the solution.
> >>
> >> I have decided to add in a config file so my application can remember
> >> the last directory use. When I run in LabView the file is created an
> >> writen to properly. When I use the Application Builder and run the
> >> program the file is not created because it can't be found.
> >>
> >> I recall sometime back someone talking about this and what you have to
> >> do if you use Application Builder and file paths. Could someone
> >> please explain it again.
> >>
> >> Thank yoy.
> >>
> >> Regards,
> >>
> >> Steve Drake
> >
>
0 Kudos
Message 5 of 8
(3,510 Views)
> The path \\netpath\c is written in a ini file as file://netpath/c and
reads back

Omit "file:" My mailer overzealously add this prefix.

Jean-Pierre Drolet
0 Kudos
Message 6 of 8
(3,510 Views)
To solve the problem of the bad path I got rid of as many "path" vi's
and went with strings. Everything runs like it should. So my rule of
thumb here is don't use the config file path vi's at all. Use a
string vi and build your own paths up.

Regards,

Steve Drake


PS: its pretty awful how these vi's work, should NI fix them?
0 Kudos
Message 8 of 8
(3,510 Views)
Jean-Pierre Drolet wrote:

> How do you build the ini path exactly? Is the VI located in the executable
> or elsewhere?
>
> Can you put an indicator somewhere to see exactly what path is generated in
> the application?
>
> The Open Config Data.vi should work for network path but a quick test
> indicates
> that the Read Key (Path).vi does not work for network path.
> The path \\netpath\c is written in a ini file as //netpath/c and reads back
> as the path
> C:\:netpath\c
>

The culprit here is a pair of functions that are buried in the "Read Key
(Path) and Write Key (Path)"
The functions are "Specific to Common Path" and "Common to Specific Path".
These are not setup to deal with MS networking paths (ie the \\ before the
machine).

The Specifi
c to common simply changes the backslash ( \ ) to a forward slash (
/ ) and stores
this in the ini file.
The Common to Specific path goes a bit further. It takes the string converts
the slashes again,
It looks for forward slash as the first character, if it is the VI strips it
out the first 2 chars,
strips the first of these then builds a string in the form of :.

That said here is the fix, which involves modifying the VI, so use at your own
risk.

Find the case for the Win95/NT. In the True Case, surround the conversion
with another case. Make the conversion of the inner case false. In the outer
case
use another string subset and examine the 2nd char (just like the original one
only with
an offset of 1). Wite this to the selector of the inner case.
The flow should be like this.

First char slash ?
Yes - Second char slash?
Yes - pass sting unaltered
No - use the original conversions
No - pass string unaltered.

This should solve the probl
em (I hope).

If any of this is unclear let me know and I will mail and or post the modified
version
Kevin Kent
0 Kudos
Message 7 of 8
(3,510 Views)