spoon Posted February 11, 2013 Share Posted February 11, 2013 (edited) Here is my code, most simple code in the world! Run('MSIEXEC.EXE /I secureclientinstaller.msi') WinWaitActive("SecureAssess Central - SecureClient AAT") Send("!N") Send("C:\Program Files\SecureAssess Central - SecureClient AAT") Send("!N") After the last line where I press 'Next' actual install starts but it depends on speed of the machine so don't really want to use Sleep. On Dell OptiPlex 990 install finishes in 45 seconds where else on OptiPlex GX620 it takes 80 seconds - you get the idea. How do I wait until finish button appears to actually press it and finish the installation? Sorry if this has already been covered but I cannot find a simple enough solution! cheers, Adrian Edited February 11, 2013 by spoon Link to comment Share on other sites More sharing options...
Colyn1337 Posted February 11, 2013 Share Posted February 11, 2013 (edited) Check out ControlGetHandle() Do $Finish = ControlGetHandle("Setup", "Finish", 1) Sleep(100) Until $Finish <> "" ControlClick("Setup", "Finish", 1) The "AutoIt Window Info Tool" is really helpful for such matters. Edited February 11, 2013 by Colyn1337 Netol 1 Link to comment Share on other sites More sharing options...
romanais Posted February 11, 2013 Share Posted February 11, 2013 Hello, WinWaitActive can do the job. See help file : WinWaitActive ( "title" [, "text" [, timeout]] ) [optional] The text of the window to check. For example, I use this to install a software @work : Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc Run('install.exe') _WinWaitActivate("Ciel Paye Evolution","ATTENTION : Ce progr") Send("{ALTDOWN}s{ALTUP}") _WinWaitActivate("Ciel Paye Evolution","Je n'accepte pas les") Send("{UP}") Send("{ALTDOWN}s{ALTUP}") _WinWaitActivate("Ciel Paye Evolution","Installatio&n standa") Send("{ALTDOWN}s{ALTUP}") _WinWaitActivate("Ciel Paye Evolution","Toutes les informati") Send("{ALTDOWN}i{ALTUP}") _WinWaitActivate("Ciel Paye Evolution","L'InstallShield Wiza") Send("{SHIFTDOWN}{TAB}{SHIFTUP}") Send("{SPACE}") Send("{ALTDOWN}t{ALTUP}") ;terminate the install With this, the speed of computer doesn't matter. The script always waits for the next window, with the good title and the good text. I also use this code to click on a cancel button. ControlClick("Ciel Paye Evolution", "", "[CLASS:Button; INSTANCE:4]") You can use Autoit window info to find the infos (text, classname, etc) I hope this will help you ! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 11, 2013 Moderators Share Posted February 11, 2013 As you are installing through an MSI, why are you waiting for anything? You could do the following to install silently, and your script will pause until the installation is complete. ShellExecuteWait("msiexec.exe", '/i "secureclientinstaller.msi" /qn') romanais 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
spoon Posted February 11, 2013 Author Share Posted February 11, 2013 (edited) As you are installing through an MSI, why are you waiting for anything? You could do the following to install silently, and your script will pause until the installation is complete. ShellExecuteWait("msiexec.exe", '/i "secureclientinstaller.msi" /qn') Tried that but it goes to the wrong place i.e. not to Program Files hence why I send that text in the first place. secureclientinstaller.msi is terribly put together to be honest... Edited February 11, 2013 by spoon Link to comment Share on other sites More sharing options...
spoon Posted February 11, 2013 Author Share Posted February 11, 2013 Check out ControlGetHandle() Do $Finish = ControlGetHandle("Setup", "Finish", 1) Sleep(100) Until $Finish <> "" ControlClick("Setup", "Finish", 1) The "AutoIt Window Info Tool" is really helpful for such matters. Here is my modified code: Run('MSIEXEC.EXE /I secureclientinstaller.msi') WinWaitActive("SecureAssess Central - SecureClient AAT") Send("!N") Send("C:\Program Files\SecureAssess Central - SecureClient AAT") Send("!N") Do $Finish = ControlGetHandle("SecureAssess Central - SecureClient AAT", "TAeroButton3", 1) Sleep(100) Until $Finish <> "" ControlClick("SecureAssess Central - SecureClient AAT", "TAeroButton3", 1) and the output of Window Info pointing at the 'Finish' button: >>>> Window <<<< Title: SecureAssess Central - SecureClient AAT Class: TPoolTemplate Position: 99, 615 Size: 503, 385 Style: 0x16CA0000 ExStyle: 0x00050100 Handle: 0x002D05A6 >>>> Control <<<< Class: TAeroButton Instance: 3 ClassnameNN: TAeroButton3 Name: Advanced (Class): [CLASS:TAeroButton; INSTANCE:3] ID: 2229076 Text: &Finish Position: 325, 325 Size: 75, 23 ControlClick Coords: 41, 8 Style: 0x5401000B ExStyle: 0x00000000 Handle: 0x00220354 >>>> Mouse <<<< Position: 468, 970 Cursor ID: 0 Color: 0xD4D0C8 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Cancel < &Back &Finish >>>> Hidden Text <<<< What am I doing wrong? Link to comment Share on other sites More sharing options...
LarryDalooza Posted February 11, 2013 Share Posted February 11, 2013 Usually in an msi install you can send a parameter like "INSTALLDIR=c:my installdir" ... worth a try AutoIt has helped make me wealthy Link to comment Share on other sites More sharing options...
Colyn1337 Posted February 11, 2013 Share Posted February 11, 2013 (edited) Try adding this at the beginning of your script AutoItSetOption("WinTitleMatchMode", 2) Here's a full example too... #NoTrayIcon AutoItSetOption("WinTitleMatchMode", 2) Run("setup.exe", @ScriptDir) WinWait("Setup") ControlClick("Setup", "&Next >", 1) ControlClick("Setup", "&Yes", 6) ControlClick("Setup", "&Next >", 1) ControlSetText("Setup", "", 303, "serial-goes-here") ControlClick("Setup", "&Next >", 1) ControlClick("Setup", "&Next >", 1) ControlClick("Setup", "&Next >", 1) ControlClick("Setup", "&Next >", 1) Do $Finish = ControlGetHandle("Setup", "Finish", 1) Sleep(100) Until $Finish <> "" ControlClick("Setup", "Finish", 1) Exit Edited February 11, 2013 by Colyn1337 Link to comment Share on other sites More sharing options...
romanais Posted February 12, 2013 Share Posted February 12, 2013 (edited) Can you try this please ? Opt("WinTextMatchMode", 2) ;1=complete, 2=quick Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase Run('MSIEXEC.EXE /I secureclientinstaller.msi') _WinWaitActivate("SecureAssess Central - SecureClient AAT","") ControlClick("SecureAssess Central - SecureClient AAT", "", "[CLASS:TAeroButton; INSTANCE:3]") _WinWaitActivate("SecureAssess Central - SecureClient AAT","Destination Folder") Send("C:\Program Files\SecureAssess Central - SecureClient AAT") ControlClick("SecureAssess Central - SecureClient AAT", "", "[CLASS:TAeroButton; INSTANCE:3]") _WinWaitActivate("SecureAssess Central - SecureClient AAT","") ControlClick("SecureAssess Central - SecureClient AAT", "", "[CLASS:TAeroButton; INSTANCE:3]") Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc Edited February 13, 2013 by romanais 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