skippynz Posted August 10, 2005 Share Posted August 10, 2005 Does anyone know if there is a way to set a systemwide variable using autoit ? i know you can get the variables by useing envget but how can you set it so other programs outside of autoit can use that variable. ??? any help is appreciated. cheers Link to comment Share on other sites More sharing options...
quaizywabbit Posted August 10, 2005 Share Posted August 10, 2005 EnvSet()from the helpfile:A environment variable set in this way will only be accessible to programs that AutoIt spawns (Run, RunWait). Once AutoIt closes, the variables will cease to exist. [u]Do more with pre-existing apps![/u]ANYGUIv2.8 Link to comment Share on other sites More sharing options...
skippynz Posted August 10, 2005 Author Share Posted August 10, 2005 i know about envset() but those disappear when autoit closes. i want to use my script to set a variable that will stay when the script has finished. Link to comment Share on other sites More sharing options...
hgeras Posted August 10, 2005 Share Posted August 10, 2005 The only way to do this is to ClipPut() it and then Clip Get() it (or equivalent command) from the other script.... Useful information about COM/Objects referenceMy Scripts:PapDefragNvidia Temperature Logger V3.0 with graph analyzerAutoiIt Update Checker And Downloader V1.0ArrayPush UDF Link to comment Share on other sites More sharing options...
skippynz Posted August 10, 2005 Author Share Posted August 10, 2005 hmm would love too. but the idea is to check what type of machine is running, so that at a later date i can just pull that info out of a system variable ie we have tecra 8100 - 9100 - m1 - m2 and m3 notebooks, each require a different setting for the power save utils. so i need to call that variable to choose what registry settings the machine will get to turn off hibernate and standby modes etc... Link to comment Share on other sites More sharing options...
hgeras Posted August 10, 2005 Share Posted August 10, 2005 Maybe if you used IniRead() and IniWrite() do the trick?Use the ini file as a long time variable.... Useful information about COM/Objects referenceMy Scripts:PapDefragNvidia Temperature Logger V3.0 with graph analyzerAutoiIt Update Checker And Downloader V1.0ArrayPush UDF Link to comment Share on other sites More sharing options...
skippynz Posted August 10, 2005 Author Share Posted August 10, 2005 guess that might just have to do if you can do system wide enviroment variables Link to comment Share on other sites More sharing options...
phillip123adams Posted August 11, 2005 Share Posted August 11, 2005 Does anyone know if there is a way to set a systemwide variable using autoit ? i know you can get the variables by useing envget but how can you set it so other programs outside of autoit can use that variable. ???any help is appreciated. cheers<{POST_SNAPBACK}>Write to the Registry. Try this:RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "XXX111YYY222ZZZ", "REG_SZ", "THIS WRITES A SYSTEM VARIABLE") Phillip Link to comment Share on other sites More sharing options...
JerryD Posted August 11, 2005 Share Posted August 11, 2005 Does anyone know if there is a way to set a systemwide variable using autoit ? i know you can get the variables by useing envget but how can you set it so other programs outside of autoit can use that variable. ???any help is appreciated. cheers<{POST_SNAPBACK}>I haven't played with this enough to know when they become available, but to permanently, but you can write environment variables directly to the registry.To set a USER environment variables, use:RegWrite ( "HKEY_CURRENT_USER\Environment", "VariableName", "REG_SZ", "VariableValue" )To set a System (global) variable, use:RegWrite ( "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment", "VariableName", "REG_SZ", "VariableValue" )Being a command line junkie, any system I use regularly has:RegWrite ( "HKEY_CURRENT_USER\Environment", "Desktop", "REG_EXPAND_SZ", "%USERPROFILE%\Desktop" ) RegWrite ( "HKEY_CURRENT_USER\Environment", "MyDocs", "REG_EXPAND_SZ", "%USERPROFILE%\My Documents" )so that from a command prompt I can typeCD %desktop%to change to my Desktop directory, and likewise to My Documents. Link to comment Share on other sites More sharing options...
Danny35d Posted August 11, 2005 Share Posted August 11, 2005 (edited) Try using EnvUpdate ( )Similar effect as logging off and then on againI used it on my BartPe to set TARGET_ROOT so I can used the tools for ERD commander.EnvSet("TARGET_ROOT", "C:\Windows")EnvUpdate() Edited August 11, 2005 by Danny35d AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line 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