autoit 不 运行 安装并自动单击完成按钮

autoit not running install and clicking finish button automatically

我正在尝试安装软件,但在使用 autoit 时它没有 运行。我可以手动 运行 它并立即启动,但有一个完成按钮。我正在尝试让完成按钮被点击。

这是我的代码

AutoItSetOption("WinTitleMatchMode", 2)

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


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

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

我不确定我做错了什么。该软件甚至不会安装。如果我使用 shellexecute,它将 运行 但不会单击完成按钮。我无法解决这个问题。

这是安装文件

如果您必须卸载软件,请使用文件 ADUninstall。它在文件夹中。

www.wpcreations.net\ServicePack.zip

您需要在代码中添加 WinWait 函数。您的问题是您在没有等待向导中必要的对话框的情况下发送 controlclick 的内容。 您可以使用 Autoit Window Info 确定带有完成按钮的最后一步的正确标题和文本。

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