Jump to content

WinWaitActivate ... do something if the window isn't found in 30 seconds ?


Go to solution Solved by TheSaint,

Recommended Posts

Title says all... is it possible to do something if the window isn't found after 30 seconds ?

I'm writing a script that takes control of firefox to automate some stuff. But sometimes the bot miss a click or the computer was lagging when the bot sent the click so it stays stuck here waiting for WinWaitActivate... Would it be possible to send the click again if it gets stuck for 30 seconds ?

Something like that:


_WinWaitActivate("Google - Mozilla Firefox","")
MouseClick("left",97,435,1) ;click search

_WinWaitActivate("Google Search Results - Mozilla Firefox","")

If the "search results" window isn't found after 30 seconds, is it possible to send MouseClick again ?


Link to comment
Share on other sites

  • Solution

Have a look at the 3rd (last) parameter in the WinWaitActive command.

Use that, and some checks in a Loop, plus an escape from the Loop ... that last could even be time based (see the Timer functions).

Or if you only want to check once more, then don't use a loop, just repeat your code.

Look at WinActive and WinActivate and include them in your code (i.e. If WinActive ).

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.


What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)


Link to comment
Share on other sites

Hi AnarchOi

as TheSaint said 3rd (last) parameter in the WinWaitActive command is your friend.

this way should do for you:

    _WinWaitActivate("Google - Mozilla Firefox", "")
    MouseClick("left", 97, 435, 1) ;click search

Until _WinWaitActivate("Google Search Results - Mozilla Firefox", "", 30)



image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...