Graeme Posted March 11, 2014 Posted March 11, 2014 Hi, I have a problem in that one script runs successfully and gets to this line MsgBox(0x40,$UpdateID,"Successfully installed update " & $UpdateID) Exit(1) This script was started by another at this point: $InstallationResult = RunWait($ExeFileFullPath & " " & $InstallerParameters) ProcessWaitClose(StringReplace($FileName,"mmupdate","exe")) SplashOff() If $InstallationResult = $DesiredResult Then FileMove($ExeFileFullPath, $FileFullPath & ".done") LogWrite("Update succeeded") Else ; the update failed... oh dear what shall we do? If 1 = MsgBox(0x21,$PrettyScriptName,"The update failed to install - try again another time?") Then FileMove($ExeFileFullPath, $FileFullPath) LogWrite("Update failed - will be retried on next launch") Else FileDelete($ExeFileFullPath) LogWrite("Update failed - deleted by user request") EndIf EndIf I had two problems - first I had to put the processwaitclose in because otherwise the program would go onto the "update failed" msgbox before getting to the "update was successful" msgbox! second even with the processwaitclose it gives the $installationResult as 0 not 1 even though when it finally finished the first script the exit code must have been 1 as that follows after msgbox which shows? Any ideas? Is it possible that 2 exit codes are produced??? Is it possible for $installationResult to be set before the program finishes? Blessings Graeme
BrewManNH Posted March 11, 2014 Posted March 11, 2014 Are you using #RequireAdmin on the real script? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
Graeme Posted March 11, 2014 Author Posted March 11, 2014 I use #requireadmin on the secondary script - the one that finishes with the Update successful msgbox but not on the other. It doesn't need it except in the rare days that there is an update. Blessings Graeme
BrewManNH Posted March 11, 2014 Posted March 11, 2014 Do you use it in the script that this line starts? "$InstallationResult = RunWait($ExeFileFullPath & " " & $InstallerParameters)" If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
Solution BrewManNH Posted March 11, 2014 Solution Posted March 11, 2014 That's why you don't get the exit code you want. When you use #requireadmin in a script, the script is immediately exited and then reran with a request to elevate permissions for it. Your RunWait sees the first exit, and doesn't know it has restarted. VAN0 1 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
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