meows Posted April 5, 2015 Share Posted April 5, 2015 After months and months of work I hit the brain dead space. I think I lost 99.83 percent of my brain power. And then this EnvSet("MYVAR") How do you use it? I need to run a exe in the directory above the current directory. Current @Script dir = C:00new Need To run a file in this C:00new00Au directory. and for 3 days now I for the life of me forgot everything ! C:00new00Au I try $s2filepath = IniRead(@ScriptDir & "\Programsettings.ini", "Filepaths", "SetupDir", "") IniRead(@ScriptDir & "\Programsettings.ini", "Filepaths", "SetupDir", "$s2filepath") FileChangeDir($s2filepath&"\") EnvUpdate Run("\0Rosewd6x32_2.exe") and $s2filepath = IniRead(@ScriptDir & "\Programsettings.ini", "Filepaths", "SetupDir", "") IniRead(@ScriptDir & "\Programsettings.ini", "Filepaths", "SetupDir", "$s2filepath") Run(@comspec & " /c cd_UP_one.bat","",@SW_HIDE) and ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Question ;If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer ;$iMsgBoxAnswer = MsgBox(36,"Add Shortcut?","Add Desktop Shortcut?", @ScriptDir ) ;Select ; Case $iMsgBoxAnswer = 6 ;Yes ;Run(@comspec & " /c cd_UP_one.bat","",@SW_HIDE) ; Case $iMsgBoxAnswer = 7 ;No ;Run("cd_UP_one.bat") And Now we get to the Junk pile.. just stuff tried.. that failed./ And Now we get to the Junk pile.. just stuff tried.. that failed./ Func startnewfile() ;MsgBox($MB_SYSTEMMODAL, "Template10", "tRegister startnewfile. All is going well.") ;Local $s2filepath = IniRead(@ScriptDir & "\Programsettings.ini", "Filepaths", "SetupDir", "") ;IniRead(@ScriptDir & "\Programsettings.ini", "Filepaths", "SetupDir", $s2filepath) ;FileChangeDir($s2filepath) ;EnvUpdate ;Global $s2filepath ;Local $sDir = IniRead(@ScriptDir & "\Programsettings.ini", "Filepaths", "SetupDir", "") ;IniRead(@ScriptDir & "\Programsettings.ini", "Filepaths", "SetupDir", $sDir) ;Run(@comspec & " /c nircmd.exe exec 0Rosewd6x32_2.exe","",@SW_HIDE) ;Run(@comspec & " /c takeit.bat","",@SW_HIDE) ;Run ("takeit.bat") ;OnAutoItExitUnRegister ( "startnewfile" ) ;GUIDelete() ;Exit Just totally lost and confused. I forgot how to run a exe in a directory below where you are at.. How about a pointer please// And whats the deal with EnvSet? if i can't use it like EnvSet($aValue) but EnvSet("MYVAR") does not compute. Link to comment Share on other sites More sharing options...
Spider001 Posted April 5, 2015 Share Posted April 5, 2015 https://www.autoitscript.com/autoit3/docs/functions/EnvSet.htm meows 1 Link to comment Share on other sites More sharing options...
meows Posted April 5, 2015 Author Share Posted April 5, 2015 Well that was fast.. See you post a query and like magic a answer suddenly is visible you did not see for the last week. Posted 17 August 2006 - 09:59 PM noteQuote In an AutoIt script, other scripts can be included using the #include" command. If "..." is used, the filename is taken to be relative to the current script. #include<funca.au3> must be placed in the running autoit versions include folder 8) Edited by Valuater, 17 August 2006 - 10:00 PM. Even though the Thanks is 9years late, Thanks to Valuater My problem is fixed. I used the Include! #include <File.au3> #include "0Rosewd6x32_2.au3" Global $s2filepath ;OnAutoItExitRegister("startnewfile") $s2filepath = IniRead(@ScriptDir & "\Programsettings.ini", "Filepaths", "SetupDir", "") IniRead(@ScriptDir & "\Programsettings.ini", "Filepaths", "SetupDir", "$s2filepath") FileCopy(@ScriptDir&"\template10.exe",$s2filepath) FileCopy(@ScriptDir&"\REN.bat",$s2filepath) FileCopy(@ScriptDir&"\Movesetup.exe",$s2filepath) FileCopy(@ScriptDir&"\0Rosewd6x32_2.au3",$s2filepath) FileCopy(@ScriptDir&"\Programsettings.ini",$s2filepath) Sleep(3000) FileDelete("0Rosewd6x32_2.au3") FileChangeDir($s2filepath&"\") EnvUpdate EnvUpdate Run("\0Rosewd6x32_2.au3") GUIDelete() Exit ;EndFunc #include <File.au3> #include "0Rosewd6x32_2.au3" Global $s2filepath ;OnAutoItExitRegister("startnewfile") $s2filepath = IniRead(@ScriptDir & "\Programsettings.ini", "Filepaths", "SetupDir", "") IniRead(@ScriptDir & "\Programsettings.ini", "Filepaths", "SetupDir", "$s2filepath") FileCopy(@ScriptDir&"\template10.exe",$s2filepath) FileCopy(@ScriptDir&"\REN.bat",$s2filepath) FileCopy(@ScriptDir&"\Movesetup.exe",$s2filepath) FileCopy(@ScriptDir&"\0Rosewd6x32_2.au3",$s2filepath) FileCopy(@ScriptDir&"\Programsettings.ini",$s2filepath) Sleep(3000) FileDelete("0Rosewd6x32_2.au3") FileChangeDir($s2filepath&"\") EnvUpdate EnvUpdate Run("\0Rosewd6x32_2.au3") GUIDelete() Exit ;EndFunc Link to comment Share on other sites More sharing options...
meows Posted April 5, 2015 Author Share Posted April 5, 2015 https://www.autoitscript.com/autoit3/docs/functions/EnvSet.htm OK yes read it and read it again. and it is greek EnvSet("MYVAR", "This is some text!") ; Retrieve the environment variable that was just assigned a value previously. Local $sEnvVar = EnvGet("MYVAR") so to use EnvSet which could be a extreemly powerful tool. you have to make the user use "This is some text!" for a sub directory name. I rest my case. Link to comment Share on other sites More sharing options...
iamtheky Posted April 5, 2015 Share Posted April 5, 2015 (edited) Are you trying to set that path to the %path% (so you call the exe by name like 'notepad.exe')? like the envupdate example? Example() Func Example() Local $sEnvVar = EnvGet("PATH") EnvSet("PATH", $sEnvVar & ";" & "C:\00new\00Au\") EnvUpdate() $sEnvVar = EnvGet("PATH") MsgBox(0, "", "The environment variable %PATH% has the value of: " & $sEnvVar) EndFunc ;==>Example Edited April 5, 2015 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
kaisies Posted April 6, 2015 Share Posted April 6, 2015 Fyi, envset does not actually set environment variables on the host system. Link to comment Share on other sites More sharing options...
SadBunny Posted April 6, 2015 Share Posted April 6, 2015 Fyi, envset does not actually set environment variables on the host system. Sure it does: EnvSet("MYVAR", "Hello!") Run(@ComSpec & " /k echo %MYVAR%") ... it's just restricted to the running script and things spawned by it, and ceases to exist when the script exits. See the remark in EnvSet's help file. Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
kaisies Posted April 6, 2015 Share Posted April 6, 2015 Yeah, that's what I meant 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