ColoradoDon Posted February 11, 2005 Share Posted February 11, 2005 (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] )Parameterstitle The title of the window to check. text [optional] The text of the window to check. timeout [optional] Timeout in seconds Return ValueSuccess: 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 February 11, 2005 by ColoradoDon Link to comment Share on other sites More sharing options...
Administrators Jon Posted February 11, 2005 Administrators Share Posted February 11, 2005 500 second timeout? You sure that's what you want? Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
ColoradoDon Posted February 11, 2005 Author Share Posted February 11, 2005 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. Link to comment Share on other sites More sharing options...
ColoradoDon Posted February 11, 2005 Author Share Posted February 11, 2005 (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 February 11, 2005 by ColoradoDon Link to comment Share on other sites More sharing options...
Administrators Jon Posted February 11, 2005 Administrators Share Posted February 11, 2005 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 Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Blue_Drache Posted February 11, 2005 Share Posted February 11, 2005 Happens all the time. Doesn't mean I've learnt to resist the urge to ask the "are you sure" question though <{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) ;- hoursBut I'm sure it'd be a bugger to code. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
KurtGP Posted November 13, 2020 Share Posted November 13, 2020 This post is still relevant in 2020, because I made the same new user first time assumption that all time was in milliseconds, while WinWait is in seconds, lol. Link to comment Share on other sites More sharing options...
Nine Posted November 13, 2020 Share Posted November 13, 2020 1 hour ago, KurtGP said: This post is still relevant in 2020, because I made the same new user first time assumption that all time was in milliseconds, while WinWait is in seconds, lol. First post and NOT relevant. Good job. Oh, sorry welcome to AutoIt forum... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
JockoDundee Posted November 13, 2020 Share Posted November 13, 2020 1 hour ago, KurtGP said: This post is still relevant in 2020, because I made the same new user first time assumption that all time was in milliseconds, while WinWait is in seconds, lol. The OP is still relevant - the fact that it is still relevant may not be. Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now