Jump to content

Recommended Posts

Posted

For $i = 1 To 10
        If WinExists("My window") Then
        ControlClick("My window","NO","[CLASS:Button; INSTANCE:1]")
        Sleep(2000)
        WinWaitActive("Check your window","test: yahoo.com",2)
        ControlClick("Check your window","test: yahoo.com","Button2")
ExitLoop
        EndIf
        Sleep(1000)
        Next

Some time "My window" is pop up 1 time and some time it is pop up twice.

The above code handle this window "My window" successfully for the 1st time its thrown but when it occurs 2nd time it unable to handle it.

Please provide some refactoring for the above code so that it can handle the pop up window "My window" 2 times

Posted

while 1
        If WinExists("My window") Then
        ControlClick("My window","NO","[CLASS:Button; INSTANCE:1]")
        Sleep(2000)
        WinWaitActive("Check your window","test: yahoo.com",2)
        ControlClick("Check your window","test: yahoo.com","Button2")
;ExitLoop
        EndIf
        Sleep(1000)
wend

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

Hi John thanks a lot,

But suppose if window  "My Window" is not pop up , not for once then for how long would it wait for the window to exist.

And if window not exist then would it get stuck there or will execute my code further.

Actually in my application this window occurs after 2 days. so i just want to write a code which checks the presence of this window. if the window exist then it can handle it .(here the probability of occurring the window is 2 times)

thanks

Posted (edited)

The code above will wait 1 second.... Then loop again...

But if it does find 'MyWindow' then it will wait a maximum of 4 seconds for 'CheckYourWindow' to be active.

Edited by NewPlaza

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...