Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: winstate
start=TimeYmdHms() current="RR 00:00:00" WinIconize("Road Runner Login Software") While WinExist("Road Runner Login Software") || WinExist("RR ") elapsed=StrCat("RR ",StrSub(TimeSubtract(TimeYmdHms(),start),10,8)) If WinExist(current) Then WinTitle(current,elapsed) If WinState("Road Runner Login Software")==1 Then WinTitle("Road Runner Login Software",elapsed) current=elapsed EndWhile
If WinState("Road Runner Login Software")==1 Then WinTitle("Road Runner Login Software",StrCat("RR ",StrSub(ontime,10,8)))
That line is doing it. All the WIL functions except WinExist will wait up to 8 seconds for the Window to appear. If the Window is not there, then a 8 second delay occurs. Change your script to:
start=TimeYmdHms() current="RR 00:00:00" WinTitle("Road Runner Login Software",current) WinIconize(current) While WinExist("RR ") elapsed=StrCat("RR ",StrSub(TimeSubtract(TimeYmdHms(),start),10,8)) If WinExist(current) Then WinTitle(current,elapsed) If WinExist("Road Runner Login Software") Then WinTitle("Road Runner Login Software",elapsed) current=elapsed EndWhile
If you don't want the wait time, put the Condition in a WinExist...
The reason for the delay is that WinBatch can get ahead of the application, and users try to do something with the window before the application has it ready - then the function fails. So most of the functions are designed to wait until the window appears.
WinExist does not wait. The "If WinExist" function does not wait so it can be used to avoid the problems you are experiencing.
if WinExist("Road Runner Login Software") If WinState("Road Runner Login Software")==1 WinTitle("Road Runner Login Software", StrCat("RR",StrSub(ontime,10,8))) endif endif
Article ID: W13124
Filename: WinState Waits up to 8 Seconds.txt
File Created: 1999:04:15:16:51:54
Last Updated: 1999:04:15:16:51:54