Is it just me, or do others also find that WinWait, WinWaitExist, and WinWaitActive are not always consistent?
If I run a loop that starts say notepad, WinWait for it to open, and then open the open dialog, then wait for it to open then close the entire works, 1 of say 100 loops will get stuck with either notepad open, or it's open dialog, and it will sit there until you intervene.
If you are seeing this. how do you cope with fixing it?
WinWait not always consistent...
Re: WinWait not always consistent...
Seems as though I found an acceptable solution....
Thanks anyhow!
Code: Select all
loop{
; WinActivate, ahk_pid %PID%
; Click the Start Batch Conversion button ClassNN:Button1
ControlClick, &Start Batch Conversion, ahk_pid %PID%,, L,1,NA ;Batch Convert to Ots
WinWait, Really Overwrite Existing Files?,,1
}
until ErrorLevel=0
Re: WinWait not always consistent...
Generally it is very difficult to get 100% reliabilty.
If macros get more complex you are getting a lot of timing difficulties and you will eventually need some nasty loops & sleep-statements to get things working.
Its a matter of a lot of fine-tuning and hopefully no user-interference.
=> ifWinExist is very reliable and very, very fast
=> ifWinActive is very, very fast but not very reliable. If the sends come to quickly, they might get lost
=> winWaitActive is pretty slow (~120ms) but generally reliable. Prefer it to ifWinActive in terms of reliabilty
If you run into trouble with winWaitActive, it is usually a coding or application issue.
I have a pretty good advice for you: Search for "winSend" in the scripting examples forum. I have written this powerful function to get a very fast and reliable and very easy to use alternative to send. I hardly use activate, ifwinactivate etc. send, click, loops and other stuff anymore and replaced them all with winSend and winClick. These command make sure, that your sends, clicks or pixegetcolor-calls ALWAYS hit the right window - even if you interfere with your mouse.
Copy my code into your macro an do calls like this:
I´d be glad to here your feedback.
If macros get more complex you are getting a lot of timing difficulties and you will eventually need some nasty loops & sleep-statements to get things working.
Its a matter of a lot of fine-tuning and hopefully no user-interference.
=> ifWinExist is very reliable and very, very fast
=> ifWinActive is very, very fast but not very reliable. If the sends come to quickly, they might get lost
=> winWaitActive is pretty slow (~120ms) but generally reliable. Prefer it to ifWinActive in terms of reliabilty
If you run into trouble with winWaitActive, it is usually a coding or application issue.
I have a pretty good advice for you: Search for "winSend" in the scripting examples forum. I have written this powerful function to get a very fast and reliable and very easy to use alternative to send. I hardly use activate, ifwinactivate etc. send, click, loops and other stuff anymore and replaced them all with winSend and winClick. These command make sure, that your sends, clicks or pixegetcolor-calls ALWAYS hit the right window - even if you interfere with your mouse.
Copy my code into your macro an do calls like this:
Code: Select all
WinSend("^shello!{Enter}","myWindowTitle,myWindowText")
- milkygirl90
- Posts: 565
- Joined: 10 Nov 2020, 21:22
Re: WinWait not always consistent...
Does anyone have a more reliable function to ensure WinWaitActive literally says what it does? To me it works only 60% of the time.
Take one of my scripts For instance, it doesn't always fully load the window before sending "Remove":
Take one of my scripts For instance, it doesn't always fully load the window before sending "Remove":
Code: Select all
#NumpadSub:: ;uninstall or remove programs
#-::
Send ^{Esc}
WinWaitActive,ahk_class Windows.UI.Core.CoreWindow,,2
SendInput Remove
Sleep 100
SendInput {enter}
Sleep 1200
SendInput {tab 2}
return
Re: WinWait not always consistent...
100 is the default windelay. if u need it to be faster, change the defaults
get rid of the timeout and it will be 100% reliable. in other words, it will wait unconditionally until the specified window becomes activemilkygirl90 wrote: ↑25 Jul 2021, 19:24Does anyone have a more reliable function to ensure WinWaitActive literally says what it does? To me it works only 60% of the time.Code: Select all
WinWaitActive,ahk_class Windows.UI.Core.CoreWindow,,2
- milkygirl90
- Posts: 565
- Joined: 10 Nov 2020, 21:22
Re: WinWait not always consistent...
got it.. thanks!
Who is online
Users browsing this forum: Ardalion, Google [Bot] and 166 guests