Jump to content

How to tell autoit to wait for windows to be appear (30 seconds), if window appears go to next action?


Recommended Posts

I am trying to automate a software installation using Autoit in Windows 7.

I am facing issue in following scenario. 

I want to wait 30 seconds to a window to be appear. If window not appears within 30 seconds, my script should go to next action.

Tried using WinWaitActive, But it always waiting for a window. if window not appears, its throws "AutoItError: timeout on wait for activate window".

Now I dont want to get this error. My script should go to next action.

Can anyone guide me on this please?

 

 

 

 

Link to comment
Share on other sites

Which program do you try to install? Most installation programs offer silent installation command line switches. So you do not need to automate the installation GUI.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

 

@ Water .. My requirement is to automate the pop-up window. I am not in the position to use silent install :(.

@John one: Following is the code that I tried:

        if autoit.win_wait_active("[CLASS:TESTINH]", 30) == 1:
            raise Exception("Env is DOWN...!!!")
        else:    
            autoit.send("{TAB}")
            autoit.send("{DOWN 3}")
            sleep(2)    
            autoit.send("{ENTER}")        
            sleep(3)
            autoit.send("{TAB 4}")
            sleep(2)
            autoit.send("{ENTER}")    
            sleep(15)

For your info : I am using python version of Autoit in the above code. Please guide me if you know any command in Autoit. So that i can implement this in python autoit.

 

Thanks.

 

Edited by rcubefather
Link to comment
Share on other sites

Local $start_time = TimerInit()
Local $window_is_active = False

While (TimerDiff($start_time) < 3000 and Not window_is_active)
    window_is_active = WinActivate("[CLASS:TESTINH]")
    Sleep(250)
WEnd

If (window_is_active) Then
    #cs
    ...
    #ce
Else
    #cs
    ...
    #ce
EndIf

 

Edited by InunoTaishou
Link to comment
Share on other sites

Did you read the "For your info" section in post #4?
He is using Python to call AutoIt. This means: Your code won't work for the OP.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

×
×
  • Create New...