scarr Posted August 13, 2020 Share Posted August 13, 2020 Hi, I have a noob question. I would like to automate installations but sometimes I have to wait and click "next" several times until I finally click "finish" I have tried the sleep command with keystrokes, and also X,Y coordinates with a mouse click but I often miss. How do I get autoit to wait for the "next" button to not be grayed out and automatically click the button during the program installation. The next button is highlighted by default each time it appears. This would be in a scenario where I'd have to click next 4 times and then click "finish". I hope this makes sense. Any help would be appreciated. Link to comment Share on other sites More sharing options...
Musashi Posted August 13, 2020 Share Posted August 13, 2020 23 minutes ago, scarr said: I would like to automate installations ... Have you checked, if the respective setup routines of your desired programs allow control via command line parameters? If this is the case, this variant would be more reliable. Earthshine 1 "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Nine Posted August 13, 2020 Share Posted August 13, 2020 Especially, check for silent install. Usually /s or /q parameter of the install exe. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Earthshine Posted August 13, 2020 Share Posted August 13, 2020 (edited) If silent isn't an option, use my WaitForControls.au3 and Log4a.au3 to log everything. I have helped several people automate installers here. The UDF (WaitForControls.au3) will automatically wait forever, unless you specify a timeout for a control and try to click it. Study that code to find out how you properly wait in a dynamic fashion I have included the logger you need. I can post a quick starter program to help get you started. Already did it earlier on the forum a day ago. Example to start installing Notepad++, someone wanted to click on the language selector expandcollapse popup#include <Timers.au3> #include <GUIConstantsEx.au3> #include "WaitForControls.au3" #include "log4a.au3" #RequireAdmin #Region ;**** Logging **** ; Enable logging and don't write to stderr _log4a_SetEnable() ; Write to stderr, set min level to warn, customize message format _log4a_SetErrorStream() _log4a_SetMinLevel($LOG4A_LEVEL_TRACE) ; If @compiled Then _log4a_SetMinLevel($LOG4A_LEVEL_WARN) ; Change the min level if the script is compiled _log4a_SetFormat("${date} | ${host} | ${level} | ${message}") #EndRegion ;**** Logging **** Const $TD_BTN_NEXT = '&Next >' Const $TD_BTN_INSTALL = '&Install' Const $TD_BTN_CANCEL = 'Cancel' Const $TD_BTN_FINISH = 'Finish' Const $TD_BTN_UNINSTALL = '&Uninstall' Const $TD_BTN_CLOSE = 'Close' Const $TD_BTN_YES = '&Yes' Const $TD_CBO_LANG = 'English' Const $formclass = "[CLASS:#32770]" Const $Edit = "[CLASS:Edit; INSTANCE:1]" Const $button1 = "[CLASS:Button; INSTANCE:1]" Const $button2 = "[CLASS:Button; INSTANCE:2]" Const $button3 = "[CLASS:Button; INSTANCE:3]" Const $cbolanguage = "[CLASS:ComboBox; INSTANCE:1]" Const $langInst = 'Installer Language' instNotepad() Func instNotepad() _log4a_Info('instNotepad:Begin') _CheckClickCtrl($formclass, $langInst, $cbolanguage, $TD_CBO_LANG, 0, 0) _log4a_Info('instNotepad():End') EndFunc ;==>instNotepad As you can see, I have defined the Button text for the Next button using a call to that same function that is poking the Language Selector Combobox Get the files you need from the first link I posted and you can see in my example program, they are included. There is extra stuff in the example to try and show you how you might also do things in a predictable manner and use variables. Use the Information Tool that comes with AutoIt and get all the buttons and combobox and edit controls you want to interact with. Then define them as a Const like I did so you can call that funciton in the udf that waits to click until the control exists and is responsive Edited August 13, 2020 by Earthshine Musashi and TheXman 2 My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Earthshine Posted August 13, 2020 Share Posted August 13, 2020 I wrote this for testing all the installer I make at work, I can't rely on silent until the manual works... lol, so silent is not always what peeps are looking for. sometimes you need to beat the snot out of your installers... to make sure they work on all install events (repair, etc..) My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
scarr Posted August 13, 2020 Author Share Posted August 13, 2020 Silent was not an option. I am working on installing an .exe to upgrade iseries client software. Earthshine this is exactly what I needed to be looking at! Thank you. Earthshine 1 Link to comment Share on other sites More sharing options...
Zedna Posted August 13, 2020 Share Posted August 13, 2020 code for waiting until disabled button change its state to enabled: While ControlCommand("Title", "Text", "Button1","IsEnabled","") = 0 Sleep(50) WEnd Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Earthshine Posted August 14, 2020 Share Posted August 14, 2020 (edited) 4 hours ago, scarr said: Silent was not an option. I am working on installing an .exe to upgrade iseries client software. Earthshine this is exactly what I needed to be looking at! Thank you. It has served me well for all of my installers and it’s really easy to whip one up. Plus it’s super reliable and a log is your debug trail. And enables you to find exactly which control you want in case there’s two similar eXE’s running or multiple instances running Edited August 14, 2020 by Earthshine My resources are limited. You must ask the right questions 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