Sign in to follow this  
Followers 0
kjcdude

WinWait not Catching Correctly

9 posts in this topic

On about 5% (20) of the computers i run my script on winwait doesn't catch a certain window that is clearly visible.

If i open notepad and save a file with the exact name on the window active it catches it and moves onto the next step.

I'm able to repeat the error, though on different pcs. There's no reason as to why it's happening or why it isn't happening on certain pcs.

Has anyone else experienced this weird bug?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Sorry, my mistake. I thought you were talking about RunWait. :-(

Yes. I think it's problem of particular programs. Some of them do complicated actions before they really starts (I think I had this problem when trying to wait for end of the Rollcage game) like running different process and terminating the original one - here it is a possibility to find out which process runs until the program has changed and then use ProcessWaitClose function. Or when they restarts (Portable Firefox/Thunderbird when updating), the scripts recognizes the program ended but don't care that they started again (which is correct behavior, though a little bit confusing).

I think the simplest "solution" will be to use some message like "Press OK after the program has ended" like Total Commander does.

Edited by raer

Share this post


Link to post
Share on other sites

Have you verified the the window information with au3info to see if its really correct ?

I have actually, i even copied pasted the window text back into the script for safety.

Share this post


Link to post
Share on other sites

On about 5% (20) of the computers i run my script on winwait doesn't catch a certain window that is clearly visible.

If i open notepad and save a file with the exact name on the window active it catches it and moves onto the next step.

I'm able to repeat the error, though on different pcs. There's no reason as to why it's happening or why it isn't happening on certain pcs.

Has anyone else experienced this weird bug?

Yep - I see the same kind of thing. I tend to use WinWait (I figure it makes more sense than 'WinWaitActive' as it should in theory prove to be a catch-all?). I've seen this in particular with certain steps of installing Java JDK 1.5.x and TortoiseSVN.

It also seems to fail more when I'm clicking around elsewhere when an install is taking place - I know this probably isn't a great idea but so long as the windows are existing, I don't see why this shouldn't work ok.

Share this post


Link to post
Share on other sites

I have actually, i even copied pasted the window text back into the script for safety.

I always use the following method cheking that a window is ready for accepting input and I have never had any problems with my scripts which are run on lots of different PCs.

WinWait("My Window", "")
    If Not WinActive("My Window", "") Then WinActivate("My Window", "")
    WinWaitActive("My Window", "")

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

I always use the following method cheking that a window is ready for accepting input and I have never had any problems with my scripts which are run on lots of different PCs.

WinWait("My Window", "")
    If Not WinActive("My Window", "") Then WinActivate("My Window", "")
    WinWaitActive("My Window", "")oÝ÷ Ûú®¢×¢»aÊ'z)éj»bréZ®'h׭趰whÂ+rدzç¢Ø£ºËgyçm¢IèÂ'âµìb²Û-éäYbµ«­¢+ÙÝ¥¹Ý¥Ð ÅÕ½ÐíµäÝ¥¹½ÜÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì¤)Ý¥¹±½Í ÅÕ½ÐíµäÝ¥¹½ÜÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì¤)ÁɽÍͱ½Í ÅÕ½ÐíµäÁɽÍ̹áÅÕ½Ðì¤

Share this post


Link to post
Share on other sites

Try setting Opt("WinTitleMatchMode", 2) to trap any variation you don't notice in the window titles. I don't know why this would vary between machines but you must also be aware that Window Titles are case sensitive.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

I just had a similar problem in a script I wrote. I was able to work around it by adding Sleep(3) right before the WinExists option.

WinWaitActive("Software License Agreement")
SEND("!y")
Sleep(3)
If WinExists("Choose Destination Location") Then
    WinWaitActive("Choose Destination Location")
    SEND("!n")
EndIf

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