Sign in to follow this  
Followers 0
mikehobbs

WinWait waits forever

4 posts in this topic

I run an exe and then

If Not WinWait($win, 20) Then

MsgBox(...flag an error...)

Exit

EndIf

This hangs forever waiting for the window.

If I replace this script with a While Not WinExists($win) and Sleep(500) it works fine.

It would appear that WinWait just hangs if the window already exists. Surely this is not sensible?

If my observation is true, the example in the documentation would not work either.

Surely it should time out, but it definitely does not. I've instrumented every line of my script with a progress report to a log file and it definitely hangs forever waiting for the window which in fact already exists by the time the function is executed.

Share this post


Link to post
Share on other sites



I run an exe and then

If Not WinWait($win, 20) Then

MsgBox(...flag an error...)

Exit

EndIf

This hangs forever waiting for the window.

If I replace this script with a While Not WinExists($win) and Sleep(500) it works fine.

It would appear that WinWait just hangs if the window already exists. Surely this is not sensible?

If my observation is true, the example in the documentation would not work either.

Surely it should time out, but it definitely does not. I've instrumented every line of my script with a progress report to a log file and it definitely hangs forever waiting for the window which in fact already exists by the time the function is executed.

Pauses execution of the script until the requested window exists.

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

Parameters

title The title of the window to check. See Title special definition.

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

timeout [optional] Timeout in seconds

with your code you are telling the script to wait indeffinatly for a win with the title $win containing text of "20"

it should be:

WinWait($win, "", 20)

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Share this post


Link to post
Share on other sites

I would do it like:

WinWait($win,"", 2000)

wait 2 secs


edited

Share this post


Link to post
Share on other sites

I would do it like:

WinWait($win,"", 2000)

wait 2 secs

This would be waiting for 2000 seconds...in win wait its already put in seconds

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

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