ur Posted October 6, 2017 Posted October 6, 2017 I am installing an setup.exe file through autoit runwait. And after installation , I need to test the application shortcut. Initially I have completed installation part and the shortcut functionality part I have done separately. Both are working as separate exe files(.au3 compiled versions). But as a final product, when I combined both of them, I am getting the error during shortcut launch as JRE_HOME variable not set. I think, when both are separate exe files, the env. variable is being set by setup file during first au3 file. And for second au3 as it is completely separate executable, it is loading the env variables from system at that point of time. But for combined version, even though it is being set in the system, the au3 being run is not taking the latest values set during its runtime. I tried restarting the explorer process also by using Run("explorer.exe",Call(ProcessClose("explorer.exe")));restart explorer But still no use. Can anyone provide your suggestions, how to handle this.
Developers Jos Posted October 6, 2017 Developers Posted October 6, 2017 Did you try EnvUpdate() ? Jos Ps: Don't know how you dreamed up that Run() statement but it looks quite "creative" SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
ur Posted October 6, 2017 Author Posted October 6, 2017 Thanks @Jos for your inputs. But the EnvUpdate is also not helpful. I am still getting the below prompt during the application launch.
aa2zz6 Posted October 6, 2017 Posted October 6, 2017 2 minutes ago, ur said: I did a google search and maybe this will help you setup the java environment variables with an Autoit script. http://trompelecode.com/blog/2009/04/autoit-script-to-set-java-home/
Developers Jos Posted October 6, 2017 Developers Posted October 6, 2017 20 minutes ago, ur said: But the EnvUpdate is also not helpful. I am still getting the below prompt during the application launch. What about you share the script so we understand why you get this error? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
ur Posted October 6, 2017 Author Posted October 6, 2017 16 minutes ago, aa2zz6 said: I did a google search and maybe this will help you setup the java environment variables with an Autoit script. http://trompelecode.com/blog/2009/04/autoit-script-to-set-java-home/ The env variable is setting up by the setup.exe itself which i am executing using runwait from my autoit script. It is updating in the env variables also. But as already the au3 process started earlier itseld, the current process is not loading the variables
ur Posted October 6, 2017 Author Posted October 6, 2017 Dependencies: ProcessEx.au3 Library.au3 CheckExistingData.au3 And the main script file is DM64.au3
ur Posted October 9, 2017 Author Posted October 9, 2017 THe env variable is being set by a thridparty setup file which I am launching from RunWait. Once the process is completed, I am launcing the shortcut it created and it needs JRE_HOME , which is set by exe. ANd it is creating also, I can check that by launching cmd and typing %JRE_HOME% But our au3 file is not loading that. Even after EnvUpdate() also.It is showing the empty messagebox for below code. MsgBox(0,"",EnvGet("JRE_HOME")) EnvUpdate();reload env. variables MsgBox(0,"",EnvGet("JRE_HOME")) Any suggestions?
Danp2 Posted October 9, 2017 Posted October 9, 2017 Have you considered respawning your script and having it pick up where it left off? Latest Webdriver UDF Release Webdriver Wiki FAQs
ur Posted October 9, 2017 Author Posted October 9, 2017 Initially both are two separate scripts. 1. For installation of 3rd party setup file. 2. For launching its shortcut and doing the functionality testing. At that time it worked as the 2nd part is a separate process completely. Now when I combined them, it is failing to load the variables created in the first part.
ur Posted October 9, 2017 Author Posted October 9, 2017 As a temporary solution, I am reading the registry value for environment variables and setting it for the session. Local $jre_env = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "JRE_HOME") If Not @error Then Logging ("JRE_HOME from registries "& $jre_env) Else Logging ("Error : Unable to Retrieve JRE_HOME env variable from Registries") Exit EndIf EnvSet("JRE_HOME", $jre_env);set JRE_HOME = $jre_env Func Logging($sMessage,$sLogFile=@ScriptDir&"\Logging.log") If $sMessage = "" Then FileWriteLine($sLogFile, "") Else FileWrite($sLogFile,_NowCalc() & " :: " & $sMessage&@CRLF) EndIf EndFunc Please let me know if you find any.
ur Posted October 9, 2017 Author Posted October 9, 2017 6 hours ago, Danp2 said: Have you considered respawning your script and having it pick up where it left off? How to do that?
Danp2 Posted October 9, 2017 Posted October 9, 2017 Just now, ur said: How to do that? Launch another instance of your script using Run and pass a parameter to indicate that the script should skip to a specific point and continue. Exit the original instance. Latest Webdriver UDF Release Webdriver Wiki FAQs
ur Posted October 9, 2017 Author Posted October 9, 2017 But it will be again a subprocess to the original one.And the variables won't get loaded right?
Danp2 Posted October 9, 2017 Posted October 9, 2017 Good question. Only way to know for sure would be to test it. ;-) Latest Webdriver UDF Release Webdriver Wiki FAQs
Danp2 Posted October 9, 2017 Posted October 9, 2017 What about if you use RunAs instead? Latest Webdriver UDF Release Webdriver Wiki FAQs
ur Posted October 9, 2017 Author Posted October 9, 2017 With a different user? But I need to launch program with the logged in user only. I will use the runas with same user credentials, may be it might work.i will let you know my inputs
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