Jump to content
Sign in to follow this  
AnarchOi

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

Recommended Posts

AnarchOi

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 ?

thanks

Share this post


Link to post
Share on other sites
TheSaint

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


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

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

Spoiler

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)

userbar.png

Share this post


Link to post
Share on other sites
Chimp

Hi AnarchOi

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

this way should do for you:

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

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

bye


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

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
Sign in to follow this  

×