The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Howto read environment variables?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

letay@ise.1

GERMANY
3 Posts

Posted - 08/14/2002 :  11:02:23 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Is there any possibility to get the contents of a system environment variable
for example the %temp% variable into a labtalk variable?

Thanks in advance

Gergoe

P.S.: I am using Origin 6.1 on Win 2000

greg

USA
1379 Posts

Posted - 08/14/2002 :  12:23:20 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
There is no access to system environment variables, except for the one you mention specifically : %TEMP%.
You can get this variable with:
system.path.findtemp(L);
which puts the %TEMP% environment variable in the %L LabTalk string variable.

Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 08/14/2002 :  1:11:20 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can access system environment variables from Origin using the run -e command to create an INI file containing those variables and then accessing them with the INI object.

## Create INI file. %A depends on your OS
## %A=command.com; // If OS is Win9x (or WinMe? not sure)
## %A=cmd.exe; // if OS is NT4, Win2k or WinXP
run -e %A /C echo [Variables]>%Ywin.ini; // Create file and section header
sec -p 0.1; // Give the command time to complete before continuing
run -e %A /C set >> %Ywin.ini; // Copy environment variables to file
sec -p 0.1; // Pause again

## Variables can now be treated as INI keys
ini.file$=%Ywin.ini;
%A=ini.Variables.windir$;
%A=; // get windows directory, for example

Hope that helps.

Mike Buess
Origin WebRing Member
Go to Top of Page

letay@ise.1

GERMANY
3 Posts

Posted - 09/12/2002 :  10:18:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Greate, thanks that helped

:g)
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000