mr-es335 Posted 13 hours ago Posted 13 hours ago Good day, Not too sure how to ask this questions, but in the following video [Click_Me], at around 11:22, the author makes mention of inserting a Sleep() command to allow time for the application to complete installation. Though this make be a means of doing so, I would assume that there has to be better options. For example, I have to install 4 applications back-to-back, and the first takes approximately 15 seconds to install, so I insert a Sleep(20000). However, I am finding this method frustrating due to inconsistency in the wait times!! I have tried various Process() commands - with no apparent success! Any ideas here? Here is sample of that script: Spoiler expandcollapse popup; ----------------------------------------------- #RequireAdmin ; ----------------------------------------------- #include <AutoItConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) AutoItSetOption("MouseCoordMode", 0) ; ----------------------------------------------- Global $iTimeOut = 100 ; --------------------- Global $sSrcAppInstallPathInstRegGR5 = "D:\App_Install\Digital_Audio\2_GR5\Apps\NI_InstReg_GR5.exe" Global $sSrcAppInstallPathGR5 = "D:\App_Install\Digital_Audio\2_GR5\Apps\GuitarRig5\Setup.exe" ; ----------------------------------------------- Install_GR5() ; ----------------------------------------------- Func Install_GR5() Local $sSrcPath1 = $sSrcAppInstallPathInstRegGR5 Local $sSrcPath2 = $sSrcAppInstallPathGR5 ; ----------------------------------------------- ; 1st dialog > Add installation data... Run($sSrcPath1) WinWait("NI InstReg Guitar Rig 5", "") WinActivate("NI InstReg Guitar Rig 5", "") ControlClick("NI InstReg Guitar Rig 5", "", 6) ; --------------------- ; 2nd dialog > Welcome... Run($sSrcPath2) WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >") ; --------------------- ; 3rd dialog > License Language Selection WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >") ; --------------------- ; 4th dialog > License Agreement WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") ControlCommand("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "", "Check") ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >") ; --------------------- ; 5th dialog > Custom Setup > Mouse Only!! WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") Sleep($iTimeOut) MouseClick($MOUSE_CLICK_LEFT, 66, 143, 1, 0) Sleep($iTimeOut) Send("{DOWN 2}{ENTER}") ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >") ; --------------------- ; 6th dialog > VST Plug-In Destination Folder WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >") ; --------------------- ; 7th dialog > Begin installation... WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", " ") WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >") ; --------------------- ; 8th dialog > Finish Sleep(20000) WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "TButton2") EndFunc ;==>Install_GR5 ; ----------------------------------------------- Any assistance would be greatly appreciated!! mr-es335 Sentinel Music Studios
mr-es335 Posted 12 hours ago Author Posted 12 hours ago (edited) Hello, How is this sampling for start? ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- FirstAppInstall() ; ----------------------------------------------- Func FirstAppInstall() Local $iPID = Run("D:\App_Install\Digital_Audio\2_GR5\Apps\NI_InstReg_GR5.exe") Local $hWnd = WinWait("[CLASS:#32770]", "", 10) Local $aProcessList = ProcessList("NI_InstReg_GR5.exe") ; ----------------------------------------------- For $i = 1 To $aProcessList[0][0] MsgBox($MB_SYSTEMMODAL, "", $aProcessList[$i][0] & @CRLF & "PID: " & $aProcessList[$i][1]) ConsoleWrite($aProcessList[$i][1]) Next ; ----------------------------------------------- If ProcessExists("NI_InstReg_GR5.exe") Then MsgBox($MB_SYSTEMMODAL, "", "NI_InstReg_GR5.exe is running") ProcessWaitClose("NI_InstReg_GR5.exe") ProcessWaitClose($iPID) SecondAppInstall() Else MsgBox($MB_SYSTEMMODAL, "", "NI_InstReg_GR5.exe is not running") EndIf EndFunc ;==>FirstAppInstall ; ----------------------------------------------- Func SecondAppInstall() MsgBox($MB_SYSTEMMODAL, "", "Install 2nd app!") EndFunc ;==>SecondAppInstall ; ----------------------------------------------- I might assume that the commented section would no longer be required? True? Not true? If ProcessExists("NI_InstReg_GR5.exe") Then MsgBox($MB_SYSTEMMODAL, "", "NI_InstReg_GR5.exe is running", 2) ProcessWaitClose("NI_InstReg_GR5.exe") ProcessWaitClose($iPID) SecondAppInstall() ;~ This section... ;~ Else ;~ MsgBox($MB_SYSTEMMODAL, "", "NI_InstReg_GR5.exe is not running", 2) EndIf Edited 12 hours ago by mr-es335 mr-es335 Sentinel Music Studios
mr-es335 Posted 12 hours ago Author Posted 12 hours ago (edited) Okay... How is this slightly stripped down version?... expandcollapse popup; ----------------------------------------------- #RequireAdmin ; ----------------------------------------------- #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) AutoItSetOption("MouseCoordMode", 0) ; ----------------------------------------------- Global $iTimeOut = 100 ; --------------------- Global $sSrcAppInstallPathInstRegGR5 = "D:\App_Install\Digital_Audio\2_GR5\Apps\NI_InstReg_GR5.exe" Global $sSrcAppInstallPathGR5 = "D:\App_Install\Digital_Audio\2_GR5\Apps\GuitarRig5\Setup.exe" ; ----------------------------------------------- Install_GR5() ; ----------------------------------------------- Func Install_GR5() Local $sSrcPath1 = $sSrcAppInstallPathInstRegGR5 Local $sSrcPath2 = $sSrcAppInstallPathGR5 Local $iPID = $sSrcPath1 ; ----------------------------------------------- ; 1st dialog > Add installation data... Run($sSrcPath1) WinWait("NI InstReg Guitar Rig 5", "") ; ----------------------------------------------- If ProcessExists("NI_InstReg_GR5.exe") Then MsgBox($MB_SYSTEMMODAL, "", "NI_InstReg_GR5.exe is running", 2) WinActivate("NI InstReg Guitar Rig 5", "") ControlClick("NI InstReg Guitar Rig 5", "", 6) ProcessWaitClose($iPID) SecondAppInstall() EndIf EndFunc ;==>Install_GR5 ; ----------------------------------------------- Func SecondAppInstall() MsgBox($MB_SYSTEMMODAL, "", "Install 2nd app!", 2) EndFunc ;==>SecondAppInstall ; ----------------------------------------------- I just want to ensure that I am "on the right track" here!!! More testing to follow... Edited 12 hours ago by mr-es335 mr-es335 Sentinel Music Studios
WildByDesign Posted 11 hours ago Posted 11 hours ago You could also check for the presence of certain files from each program. If all known files exist, you would know that all programs have been installed. I would probably use an AdlibRegister to keep checking.
mr-es335 Posted 11 hours ago Author Posted 11 hours ago Okay3, Well, it would appear that I am back at the beginning?!? The issues stem from the following: ; --------------------- ; 7th dialog > Begin installation... WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", " ") WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "&Next >") ; --------------------- ; 8th dialog > Finish Sleep(20000) WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "TButton2") As the same dialog is being employed throughout dialogs 2 to 8, the installation appears to end at the end of the 7th dialog!! Thus the apparent need for Sleep(20000)? Is there anyway around this anomaly?? mr-es335 Sentinel Music Studios
Solution Resiak1811 Posted 10 hours ago Solution Posted 10 hours ago (edited) suggestion: If you have a "Next" button which is unavailable during the install and available when the install is waiting for the next step, do something like "while NextButton is not available sleep(1000)" :: Do Sleep(2000) Until ControlCommand($title, "Close", "[CLASS:Button; INSTANCE:1]", "IsEnabled") Edited 10 hours ago by Resiak1811 mr-es335 1
mr-es335 Posted 9 hours ago Author Posted 9 hours ago Resiak1811, Attempting to implement your offering - and which appears to "work", the following ConsoleWrite's... ; 6th dialog > Begin installation... Do Sleep(1500) ConsoleWrite("6th dialog" & @CRLF) WinWait("Native Instruments Rammfire - InstallAware Wizard", " ") WinActivate("Native Instruments Rammfire - InstallAware Wizard", "") ControlClick("Native Instruments Rammfire - InstallAware Wizard", "", "&Next >") Until ControlCommand("Native Instruments Rammfire - InstallAware Wizard", "Finish", "[CLASS:TButton; INSTANCE:2]", "IsEnabled") ; --------------------- ; 7th dialog > Finish ConsoleWrite("7th dialog" & @CRLF) WinWait("Native Instruments Rammfire - InstallAware Wizard", "") WinActivate("Native Instruments Rammfire - InstallAware Wizard", "") ControlClick("Native Instruments Rammfire - InstallAware Wizard", "", "TButton2") ...produces the following output: 6th dialog 6th dialog 7th dialog Trying to get me head around precisely WHAT this DO|LOOP is DOing?!? mr-es335 Sentinel Music Studios
Resiak1811 Posted 8 hours ago Posted 8 hours ago the loop is waiting for the button to be available for the click.. you should only put the sleep() in it : ; 6th dialog > Begin installation... Do Sleep(1500) Until ControlCommand("Native Instruments Rammfire - InstallAware Wizard", "&Next >", "[CLASS:????; INSTANCE:????]", "IsEnabled") ; (you need to have the CLASS and INSTANCE (and the right text) for your button) --> can be get with the autoit tool (Autoit Window Info) ; so your scrippt will loop until the button is available for click and continue with : ConsoleWrite("6th dialog" & @CRLF) WinWait("Native Instruments Rammfire - InstallAware Wizard", " ") WinActivate("Native Instruments Rammfire - InstallAware Wizard", "") ControlClick("Native Instruments Rammfire - InstallAware Wizard", "", "&Next >") ; --------------------- ; 7th dialog > Finish Do Sleep(1500) Until ControlCommand("Native Instruments Rammfire - InstallAware Wizard", "Finish", "[CLASS:????; INSTANCE:????]", "IsEnabled") ; (you need to have the CLASS and INSTANCE (and the right text) for your button) --> can be get with the autoit tool (Autoit Window Info) ; so your scrippt will loop until the button is available for click and continue with : ConsoleWrite("7th dialog" & @CRLF) WinWait("Native Instruments Rammfire - InstallAware Wizard", "") WinActivate("Native Instruments Rammfire - InstallAware Wizard", "") ControlClick("Native Instruments Rammfire - InstallAware Wizard", "", "TButton2") mr-es335 1
mr-es335 Posted 7 hours ago Author Posted 7 hours ago (edited) Resiak1811, Thank you so very much for the assistance...greatly appreciated!! The Do|Loop is only required in the 8th section...so here is what I have: ; 8th dialog > Finish Do Sleep(100) Until ControlCommand("Native Instruments Guitar Rig 5 - InstallAware Wizard", "Finish", "[CLASS:TButton; INSTANCE:2]", "IsEnabled") ; --------------------- WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "TButton2") ...and just for fun... ; 8th dialog > Finish ConsoleWrite("Just before Do|Loop..." & @CRLF) ConsoleWrite("Todays date/Time: " & _Now() & @CRLF) Do Sleep(100) Until ControlCommand("Native Instruments Guitar Rig 5 - InstallAware Wizard", "Finish", "[CLASS:TButton; INSTANCE:2]", "IsEnabled") ; --------------------- ConsoleWrite("Just after Do|Loop..." & @CRLF) ConsoleWrite("Todays date/Time: " & _Now() & @CRLF) WinWait("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") WinActivate("Native Instruments Guitar Rig 5 - InstallAware Wizard", "") ControlClick("Native Instruments Guitar Rig 5 - InstallAware Wizard", "", "TButton2") The first offering works as expected! I also wanted to know when-and-where the the codes was doing with the GUI's. I then added the _Now() to ascertain how long the actual installation too...which was some 15 seconds! What I would like to know however, is how the thought came-to-mind, for, as you stated, "...while NextButton is not available sleep(1000)...?!?" "If I do NOT know the questions to ask, how can I be expected to get the answers?" Edited 7 hours ago by mr-es335 mr-es335 Sentinel Music Studios
Resiak1811 Posted 6 hours ago Posted 6 hours ago I'm glad I could help This comes from an old automated installation program I created. Each program can be installed one after the other without user intervention. mr-es335 1
mr-es335 Posted 6 hours ago Author Posted 6 hours ago Where can I get this program!!! mr-es335 Sentinel Music Studios
Resiak1811 Posted 6 hours ago Posted 6 hours ago It's a private program that I created for a company where I worked. (not available to the public) sorry
mr-es335 Posted 5 hours ago Author Posted 5 hours ago Resiak1811, No problem! Thanks regardless!! mr-es335 Sentinel Music Studios
mr-es335 Posted 4 hours ago Author Posted 4 hours ago Hello, For confirmation, I have added the following: ; Confirm installation If ProcessExists($sSrcAppInstallPathRammfire) Then _ExtMsgBoxSet(64, 4, Default, Default, 16, "Corbel Bold", $iEMBWidth) $sMsg = "Rammfire is running!" _ExtMsgBox(128, " ", " This dialog will exit in 2 seconds...", $sMsg, $iMsgDelay) Else _ExtMsgBoxSet(64, 4, Default, Default, 16, "Corbel Bold", $iEMBWidth) $sMsg = "Rammfire install is now completed!" _ExtMsgBox(128, " ", " This dialog will exit in 2 seconds...", $sMsg, $iMsgDelay) EndIf mr-es335 Sentinel Music Studios
Resiak1811 Posted 4 hours ago Posted 4 hours ago I never played with _ExtMsgBoxSet you should that a look at : SplashTextOn / SplashOff for you in-loop message
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