LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Environment variables

Hi

Does anybody know how to manage (read, create & destroy) windows environment
variables with LabView 6 ?
More particularly, how to get the path to Windows temporary folder ?

Thanks.
0 Kudos
Message 1 of 8
(4,367 Views)
From the "Functions" palette on the block diagram:

File I/O -> File Constants -> Temporary Directory

If that doesn't do it for you, you must resort the Win32 API (GetTempPath) which may or may not be LV friendly.
0 Kudos
Message 2 of 8
(4,367 Views)
This returns the path to the LabVIEW temp directory, which is set as an 'application environment variable' in LabVIEW options, and does not return the windows temp directory.

I checked my MSDN for answers to this, and found the usual crap from Microsoft that tapdanced around a real answer. I think I'm going to give up MS Visual Studio and port to Unix, a real programming environment with real support from people who actually document their software.... but I digress...

The best I could tell is that there IS a way to get this information. It is probably something you will have to look on the web for.

Please do this forum a service and post the results should you find them. That way, when someone else wants to know this, they can find this thr
ead and know.

Thanks, and good luck.
Message 3 of 8
(4,367 Views)
OK, I wrote a particular CIN to read these environment variables. If anyone
interested ...

"Eric Hervieu" a écrit dans le message de news:
an1np0$b03$1@ellebore.saclay.cea.fr...
> Hi
>
> Does anybody know how to manage (read, create & destroy) windows
environment
> variables with LabView 6 ?
> More particularly, how to get the path to Windows temporary folder ?
>
> Thanks.
>
>
>
0 Kudos
Message 4 of 8
(4,367 Views)
DWORD GetTempPath(
DWORD nBufferLength, // size of buffer
LPTSTR lpBuffer // path buffer
);

this is really all you need to get the temp path.

Download it here:

http://www.air.nl/nlibrary/gettempdirectory_vi.html


Regards,

Wiebe.

"Labviewguru" wrote in message
news:506500000005000000E0A40000-1031838699000@exchange.ni.com...
> This returns the path to the LabVIEW temp directory, which is set as
> an 'application environment variable' in LabVIEW options, and does not
> return the windows temp directory.
>
> I checked my MSDN for answers to this, and found the usual crap from
> Microsoft that tapdanced around a real answer. I think I'm going to
> give up MS Visual Studio and port to Unix, a real programming
> envi
ronment with real support from people who actually document their
> software.... but I digress...
>
> The best I could tell is that there IS a way to get this information.
> It is probably something you will have to look on the web for.
>
> Please do this forum a service and post the results should you find
> them. That way, when someone else wants to know this, they can find
> this thread and know.
>
> Thanks, and good luck.
0 Kudos
Message 5 of 8
(4,367 Views)
eric.hervieu@cea.fr (Eric Hervieu) wrote in
:

>Hi
>
>Does anybody know how to manage (read, create & destroy) windows
>environment variables with LabView 6 ?
>More particularly, how to get the path to Windows temporary folder ?
>

You could use the "system exec.vi" and pass the word "SET" to it. The
results are the list of all environment variables. Parsing the results will
reveal what you want.

cheers, Alex.

--

Alexander C. Le Dain, PhD
ICON Technologies Pty Ltd
http://www.icon-tech.com.au

******************************************************************
* The LabVIEW FAQ http://www.icon-tech.com.au/thelabviewfaq.html *
******************************************************************
0 Kudos
Message 6 of 8
(4,367 Views)
Probably the easiest way for you to get the Windows Temp directory is to access the Windows Script Host Model using OLE Automation. I've got a vi that does that, in several Labview versions (5.0, 6.0.2 and 6.1). I have also included a vi that accesses the Windows API to get various other important and hard to get folder paths, like the Desktop folder, My Documents folder, etc. These are folders whose location can change from Operating System to Operating System or even from PC to PC (as for example, if you replace your existing Windows 98 system, the new Windows folder may be "C:\Win98" instead of "C:\Windows", which can screw up all the other hard coded locations you've got in your code.)
0 Kudos
Message 7 of 8
(4,363 Views)
That function does not give the Windows Operating System 'Temp' folder. To get that, there are indeed WIndows API DLLs, and there is also an elegant OLE Automation solution.
0 Kudos
Message 8 of 8
(4,365 Views)