Jump to content
DanielRossinsky

Program closes even regardless of WinWait

Recommended Posts

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 ?

Share this post


Link to post
Share on other sites

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:

  1.  Does this apply to any function with a text parameter ? (From what I understood it does but just want to make sure)
  2.  Is there a more elegant way to achieve the same result ? like a silent install which closes the installer automatically upon finish ?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...