mist3r Posted July 2, 2006 Share Posted July 2, 2006 Hey, I'm wanting to make a sweet and simple script that will message box a variable set within Windows. I've looked at the Env functions but I think im getting confused between variables I define within the program and windows variables. So if I defined "LOCATION" as "UPSTAIRS" in windows, then by running a script it will simply msgbox "UPSTAIRS". I think its in the registry and what command would i need to read it? I've been trying all sorts but with no joy Thanks for your help, very much appreciated phil Link to comment Share on other sites More sharing options...
raedts Posted July 2, 2006 Share Posted July 2, 2006 (edited) Exactly where are you setting these variables? With that i mean: Where do you define "UPSTAIRS" If you mean in the source code of your program, this would be it: $location = "upstairs" msgbox (0,"Sweet script", $location) Edited July 2, 2006 by raedts Link to comment Share on other sites More sharing options...
mist3r Posted July 2, 2006 Author Share Posted July 2, 2006 Ok cool, sort of heh... thanks but I goto rightclick my computer... properties to bring up the system information. Click advanced > environmental variables and set it within that. It's just for a printer logon script that I need to set it in there. Thing is, im trying to make a quick nasty program that will check to see if the machines settings are correct. It will basically check to see if a folder exists to determine whether or not its been installed. So within my work, we have to install loads n loads of software and set certain things including the location. This program will basically check things and then pop up if its not set or atleast indicat what its been set to. Thanks raedts for ya help, prehaps you know how to read those variables ? Link to comment Share on other sites More sharing options...
raedts Posted July 2, 2006 Share Posted July 2, 2006 Ahh the nework settings, i will try to look them up... It's late/early here(1 am in the morning). so if i don't find them quickly you may have to wait some time because i need to sleep Link to comment Share on other sites More sharing options...
raedts Posted July 2, 2006 Share Posted July 2, 2006 (edited) FOUND! Its stored in the registry: HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment How to read it? uhh zzzz. srry uhm i need sleep... This pc doesn't have AutoIt installed, maybe you could look yourself in the Help Files of autoit, i think its like Regread or something... I will reply tomorrow . Maybe some other forum member could help you out with reading it.... Cya! Edited July 2, 2006 by raedts Link to comment Share on other sites More sharing options...
herewasplato Posted July 2, 2006 Share Posted July 2, 2006 (edited) If the variable is set in the area labeled:User variables for LocalControlit will be written toHKEY_CURRENT_USER\EnvironmentJust set some variable and serach the registry for it...Edit:If the variable is set in the area labeled:System variablesHKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\EnvironmentEdit2:From Mastering Windows XP Registryby Peter HipsonThere are also other aliases in the registry. For example, the registry keyHKEY_LOCAL_MACHINE\_System\CurrentControlSet is an alias to one of the othercontrol setsControlSet001, ControlSet002, or sometimes ControlSet003. Again, this is thatsame magic; only one registry object is there, it just has two names. Remember, in modifyinga specific registry key or subkey; don't be surprised when another registry key or subkeyseems to magically change also!556 pages of stuff I don't understand... Edited July 3, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
mist3r Posted July 2, 2006 Author Share Posted July 2, 2006 Awesome!! No thats very helpful you guys. Its about 12:12AM here so im gonna go to sleep n all. I'll crack on with it tommoz morning, thanks for being soo speedy. Cheers! Link to comment Share on other sites More sharing options...
raedts Posted July 2, 2006 Share Posted July 2, 2006 Sigh.... coudnlt help it I am addicted to AutoIt code: $test = RegRead ( "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment", "LOCATION" ) MsgBox (0,"test", $test) This is for System Variables. You could change "LOCATION" into what ever you want... Link to comment Share on other sites More sharing options...
mist3r Posted July 2, 2006 Author Share Posted July 2, 2006 Aaah aarh!! $location = RegRead( "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment", "LOCATION" ) msgbox (0,"Sweet script", $location) Wooah my first script that worked lol Cheers again! Now im going to attempt a few IF's.. so if its blank then give me the option to set it prehaps. Heh, i'll be posting again very very soon. Link to comment Share on other sites More sharing options...
raedts Posted July 3, 2006 Share Posted July 3, 2006 Edit2:I know raedts had that info from my edit... no i didn't :S i just created a varable: Lokaal113 and searched the registry Link to comment Share on other sites More sharing options...
herewasplato Posted July 3, 2006 Share Posted July 3, 2006 (edited) no i didn't :S i just created a varable: Lokaal113 and searched the registry I was attempting to explain these 3 things:That I had seen your post.My first edit duplicated some of your info.There seemed to be little reason for me to make that first edit......but I was building toward putting all 3 bits of info into one post.I did not mean to imply that you got any info from me - it was just very poorly worded.Perhaps this would have been better:I know that raedts beat me to the info shown in my first edit...edit: added more words.... :-) Edited July 4, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
raedts Posted July 3, 2006 Share Posted July 3, 2006 Ahh sorry i judged to quick ^^ Link to comment Share on other sites More sharing options...
herewasplato Posted July 4, 2006 Share Posted July 4, 2006 (edited) Ahh sorry i judged to quick ^^No problem...If I could only type fasterhttp://www.autoitscript.com/forum/index.ph...st&p=202804...I would have beat you to the post. :-) :-) Edited July 4, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now