Search code examples
autoit

autoit not running install and clicking finish button automatically


I am trying to install software but it does not run when using autoit. I can run it manually and it starts right up but has a finish button. I am trying to get the finish button to be clicked.

Here is my code

AutoItSetOption("WinTitleMatchMode", 2)

$InstallPath = @ScriptDir & "\setup.exe"


If FileExists($InstallPath) Then
Run($InstallPath)

ControlClick("ADM 3.51 Service Pack - InstallShield Wizard", "", 1)
EndIf

I am not sure what i am doing wrong. The software will not even install. If i use shellexecute it will run but not click the finish button. I can not wrap my head around this.

Here are the install files

if you have to uninstall the software use the file ADMuninstall. It is in the folder.

www.wpcreations.net\ServicePack.zip


Solution

  • You need to add WinWait function to your code. Your problem is what you sends controlclick without waiting of necessary dialog in wizard. You can use Autoit Window Info to determine proper title and text of final step with finish button.

    AutoItSetOption("WinTitleMatchMode", 2)
    $InstallPath = @ScriptDir & "\setup.exe"
    If FileExists($InstallPath) Then
       Run($InstallPath)
       WinWait("ADM 3.51 Service Pack - InstallShield Wizard","successfull")    ; add here proper title and text from Autoit Window Info
       ControlClick("ADM 3.51 Service Pack - InstallShield Wizard", "", 1)      ; check here ID of finish button
    EndIf