davezub Posted November 21, 2005 Share Posted November 21, 2005 Ok I realize that you can use runwait to grab an errorlevel, however, I have a requirement that I have to use run for a program. Basically this is what I'm doing: 1. Installing XP SP2 2. I'm running update.exe and then turning off the the cancel button using controldisable. Is there any way to grab the errorlevel from update without using runwait? Here is the snippet of code: ;Run Update returns the PID Program ID to a var $Pid = Run($XPSP2Command,$XPSP2Folder ) WriteLogFile ("Start XP SP2 Install") ;Waits for XPSP2 Window to Popup WinWait($XPSP2Windowtitle) ;Disables the Cancel and Help Buttons ControlDisable($XPSP2Windowtitle,"Cancel", 2) ControlDisable($XPSP2Windowtitle,"Help", 9) WriteLogFile ("Disable Buttons") ;Waits for PID to close ProcessWaitClose($Pid) WriteLogFile ("Stop XP SP2 Install") Thanks Link to comment Share on other sites More sharing options...
Developers Jos Posted November 21, 2005 Developers Share Posted November 21, 2005 (edited) What about doing it this way: The script start itself again with a parameter so the second instance disables the button for you? Here is the scriptlet which will only work when it is compiled:If $cmdline[0] = 1 and $cmdline[1] = "extras" then ;Waits for XPSP2 Window to Popup WinWait($XPSP2Windowtitle) ;Disables the Cancel and Help Buttons ControlDisable($XPSP2Windowtitle,"Cancel", 2) ControlDisable($XPSP2Windowtitle,"Help", 9) WriteLogFile ("Disable Buttons") Exit EndIf ;Run Itself as Update returns the PID Program ID to a var Run(@ScriptFullPath & " extras",@ScriptDir) ;Run Update returns the PID Program ID to a var WriteLogFile ("Start XP SP2 Install") $RC = RunWait($XPSP2Command,$XPSP2Folder ) WriteLogFile ("Stop XP SP2 Install:" & $RC) Edited November 21, 2005 by JdeB 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. Link to comment Share on other sites More sharing options...
herewasplato Posted November 21, 2005 Share Posted November 21, 2005 ...I'm running update.exe...JdeB has given you a great work around for the path that you were taking.You might want to look into unattended installation of XP SP2 as described here:http://www.microsoft.com/technet/prodtechn...y/spdeploy.mspx...or maybe not. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
davezub Posted November 21, 2005 Author Share Posted November 21, 2005 Thanks nice resource but still does not cure Microsoft's oversight of displaying the cancel button when using /passive. What are most users going to do hit cancel. I thought about a custom message and using runwait with /quiet but I want to provide feedback to the user about what's going on since this is a lenghty install.JdeB has given you a great work around for the path that you were taking.You might want to look into unattended installation of XP SP2 as described here:http://www.microsoft.com/technet/prodtechn...y/spdeploy.mspx...or maybe not. Link to comment Share on other sites More sharing options...
herewasplato Posted November 21, 2005 Share Posted November 21, 2005 ...Microsoft's oversight of displaying the cancel button when using /passive.I did not know that... Thanks for the info. Your script(s) should solve that.have fun [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