forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Environment variables
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Tue Nov 04, 2003 7:12 pm    Post subject: Reply with quote

Hi All,
Here is a link to the MSDN page that talks about setting global environment variables with the utility winset.exe

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q140/5/74.asp&NoWebContent=1

Wink

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 480
Location: California

PostPosted: Tue Nov 04, 2003 8:10 pm    Post subject: Reply with quote

Jules,
First off, I think I too am one of the few to remember that AST sixpacks were not cheap beer... (but an add-on card that added 256K+ of memory and a real time clock, among other things!) Laughing
But, back to env. vars... in W2k and XP if you set an system env. var. (My computer --> properties --> advanced --> environment variables), you can see that it immediately takes effect by opening a command prompt and typing in "set" with no switches. Although I suppose I could write a script to control those windows, it is not a "clean" solution...
bbelcher's idea only works for the currently logged in user, and only then when it too is touched through the above mentioned edit window.
So far, it sounds to me that my only hope is FreezingFire's API solution. Wink
double thanks...

_________________
Hooligan

Why be normal?
Back to top
View user's profile Send private message
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 480
Location: California

PostPosted: Tue Nov 04, 2003 8:18 pm    Post subject: Reply with quote

Mind power,
It sounds like your on to something... could you post the URL of that MSDN note?
thanks...

_________________
Hooligan

Why be normal?
Back to top
View user's profile Send private message
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Wed Nov 05, 2003 7:19 am    Post subject: Reply with quote

Hooligan wrote:
But, back to env. vars... in W2k and XP if you set an system env. var. (My computer --> properties --> advanced --> environment variables), you can see that it immediately takes effect by opening a command prompt and typing in "set" with no switches.


It does seem though that the change only takes effect for newly spawn processes and
not for existing running applications.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Wed Nov 05, 2003 9:12 am    Post subject: Reply with quote

Possibly what I said applied to Win95/98/Me. It's only from memory, as I only have XP now, and I can't say that I've ever bothered with environment variables under XP.
_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Wed Nov 05, 2003 9:14 am    Post subject: Reply with quote

mindpower wrote:
Hi All,
Here is a link to the MSDN page that talks about setting global environment variables with the utility winset.exe

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q140/5/74.asp&NoWebContent=1

Wink


Well, well. That's the first I've ever heard of this utility. Just goes to show even when you think you know everything, there's still something new to learn. Wink

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Thu Nov 06, 2003 6:27 am    Post subject: Reply with quote

It's just as mindpower said. The below script appears to set environment vars for even a running app if it responds to WM_SETTINGCHANGE message. You can try this script. tested on XP - possibly works on win 2k /NT

Code:
 
   REM Define  highlighed green ?
   #DEFINE COMMAND,SYSENV
   #DEFINE FUNCTION,SYSENV
  DIALOG CREATE,New Dialog,-1,0,314,105
  DIALOG ADD,EDIT,EDIT1,31,14,125,19,
  DIALOG ADD,EDIT,EDIT2,31,151,125,19,
  DIALOG ADD,BUTTON,BUTTON1,66,94,107,24,Test,,Default
  DIALOG ADD,TEXT,Name,17,14,,,Name
  DIALOG ADD,TEXT,Value,17,152,,,Value
  DIALOG SHOW
 
:EVLOOP
WAIT EVENT
GOTO @EVENT()

:BUTTON1BUTTON
%N = @DLGTEXT(EDIT1)
%V = @DLGTEXT(EDIT2)
REM Create a new key %N specifying the system env variable with value %V
SYSENV WRITE,%N,%V
REM Check if the write was sucessful.
INFO @SYSENV(READ,%N)!
REM Delete the key %N
SYSENV DELETE,%N
REM Check if the deletion was sucessful.
INFO @SYSENV(READ,%N)!
GOTO EVLOOP

:CLOSE
EXIT

REM You can include the below sub in a seperate include file/DSU
:SYSENV
IF @EQUAL(%1,WRITE)
GOTO SYSENV_WRITE
ELSIF @EQUAL(%1,READ)
GOTO SYSENV_READ
ELSIF @EQUAL(%1,DELETE)
GOTO SYSENV_DELETE
ELSE
EXIT
END


:SYSENV_WRITE
LOADLIB USER32
IF @NOT(@NULL(%2))
REGISTRY WRITE,LOCAL,System\CurrentControlSet\Control\Session Manager\Environment,%2,%3
%A = @LIB(USER32,SendMessageA,int:,$FFFF,$1A,1,Environment)
END
FREELIB USER32
EXIT

:SYSENV_READ
%A = @REGREAD(LOCAL,System\CurrentControlSet\Control\Session Manager\Environment,%2)
EXIT %A


:SYSENV_DELETE
LOADLIB USER32
IF @NOT(@NULL(%2))
REGISTRY DELETE,LOCAL,System\CurrentControlSet\Control\Session Manager\Environment,%2
%A = @LIB(USER32,SendMessageA,int:,$FFFF,$1A,1,Environment)
END
FREELIB USER32
EXIT

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 480
Location: California

PostPosted: Thu Nov 06, 2003 4:10 pm    Post subject: Reply with quote

CodeScript,
You are awsome!!! Your script works flawlessly on NT4sp6, w2k and XP embedded! Did I mention that your awsome?

Thanks everyone for your help!

Hooligan Very Happy Very Happy Very Happy

_________________
Hooligan

Why be normal?
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Thu Nov 06, 2003 9:00 pm    Post subject: Reply with quote

Nice! Thanks CodeScript even if I didn't ask for it, this might come in
handy some day. Very Happy

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group