Sign in to follow this  
Followers 0
ColoradoDon

WinWaitActive timeout behavior?

6 posts in this topic

#1 ·  Posted (edited)

In reading the definition of what WinWaitActive should do, I get the sense that the timeout fires off if the window you are waiting for doesn't become active.

WinWaitActive ( "title", ["text"], [timeout] )

Parameters

title      The title of the window to check.

text      [optional] The text of the window to check.

timeout [optional] Timeout in seconds

Return Value

Success: Returns 1.

Failure: Returns 0 if timeout occurred.

However, in practice, this doesn't appear to be the case. Could someone explain to me the behavior of the timeout in this function?

Here's a simple two lines that you can test this behavior with, this will look for the first window when you launch the Add Printer Wizard in Windows XP. In my test, the WinWaitActive line doesn't actually expire until I bring up the wizard.

WinWaitActive("Add Printer Wizard","",500)

MsgBox(0,"Nope","Didn't find it")

Secondly, I want to have my script look for the window, and after a certain time period, move on to the next line of code if it doesn't (i.e. when it times out).

Any help on these would be greatly appreciated.

[Edit] Clarification of the central question.

Edited by ColoradoDon

Share this post


Link to post
Share on other sites



500 second timeout?  You sure that's what you want?

<{POST_SNAPBACK}>

Ok, feeling silly now. Let me go test the behavior in my real script real quick and get back with you.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Yes, feeling exceptionally silly. It works as expected. Sorry for taking your time.

[Edit] I understand why I was confused. Got mixed up between the seconds that WinWaitActive() uses and the milliseconds that Sleep() uses.

Edited by ColoradoDon

Share this post


Link to post
Share on other sites

Yes, feeling exceptionally silly.  It works as expected.  Sorry for taking your time.

[Edit] I understand why I was confused.  Got mixed up between the seconds that WinWaitActive() uses and the milliseconds that Sleep() uses.

Happens all the time. Doesn't mean I've learnt to resist the urge to ask the "are you sure" question though :lmao:

Share this post


Link to post
Share on other sites

Happens all the time.  Doesn't mean I've learnt to resist the urge to ask the "are you sure" question though  :lmao:

<{POST_SNAPBACK}>

To tell the honest truth, I'd rather have a timer function that waits based on a suffix you put after the number, For example:
WinWaitActive($title,$text,500 ms);- miliseconds
WinWaitActive($title,$text,500 s) ;- seconds
WinWaitActive($title,$text,500 m);- minutes
WinWaitActive($title,$text,500 h) ;- hours

But I'm sure it'd be a bugger to code.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

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  
Followers 0