DanielRossinsky Posted June 7, 2020 Share Posted June 7, 2020 Hello! I'm a new member on the forum and pretty new to AutoIt. As a part of my learning i decided to implement an automated installer for python and ran into quite an odd problem - The script tries to close the installer before its finished! #RequireAdmin Func InstallPython() Local Const $sInstallerPath = @ScriptDir & "\python.exe" Run($sInstallerPath) Local $hWnd = WinWait("Python 3.8.3 (32-bit) Setup") ControlCommand($hWnd, "Add &Python 3.8 to PATH", 266, "Check") ControlClick($hWnd, "&Install Now", 1026) WinWait($hWnd, "Setup was successful") WinClose($hWnd) ;For some odd reason this gets called before WinWait finishes EndFunc ;==>InstallPython InstallPython() I've tried other functions like ControlClick on the close button however i get the same result prompting me if i want to cancel the installation behaving as if WinWait is not even there. Heck, I even tried text other than "Setup was successful" using the AutoIt tool and still same result. However, what i did notice is if i remove WinClose than it fixes it partly because we are still stuck with a window we need to close by hand when the goal is to automate the process... Any ideas as to what the problem can be ? Link to comment Share on other sites More sharing options...
Danp2 Posted June 7, 2020 Share Posted June 7, 2020 From here -- Quote When you use a window handle for the title parameter then the text parameter is completely ignored. So drop the use of the handle if you want to use the text parameter. DanielRossinsky 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
DanielRossinsky Posted June 7, 2020 Author Share Posted June 7, 2020 Wow I cant believe i missed that! I feel so dumb for it... I'd like to ask you 2 questions if you have the time: Does this apply to any function with a text parameter ? (From what I understood it does but just want to make sure) Is there a more elegant way to achieve the same result ? like a silent install which closes the installer automatically upon finish ? Link to comment Share on other sites More sharing options...
Danp2 Posted June 7, 2020 Share Posted June 7, 2020 I believe that Python offers a silent install option. See https://docs.python.org/3/using/windows.html#installing-without-ui Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
careca Posted June 7, 2020 Share Posted June 7, 2020 Did you search for the installer switches? I tried python-3.8.3.exe /s and it worked, completely silent. Also, i called the setup with /? and got this list of switches that can be used. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe 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