epicfail Posted September 26, 2009 Author Posted September 26, 2009 1 more thing if i have to while loops do i need to add $init = TimerInit() twice 4 each 1 or do i just have it at the top of my script? $init = TimerInit() While 1 If TimerDiff($init) > 600000 Then Exit EndIf If WinActive("Untitled -") Then ExitLoop EndIf sleep(50) Wend sleep(10000) $init = TimerInit() ;do i need this here or not? While 1 If TimerDiff($init) > 600000 Then Exit EndIf If WinActive("Untitled -") Then ExitLoop EndIf sleep(50) Wend
herewasplato Posted September 26, 2009 Posted September 26, 2009 wow sweet that was fast. $init = TimerInit(10) While TimerDiff($init) < .. whatever value here for 10 minutes If WinActive("Untitled - Notepad") Then ExitLoop EndIf Wend so is that right if it dont find notepad withen 10 min it will end the loop? Pardon my jumping in and going so far back up in your thread, but you said: if it dont find notepad... Do you want the script to wait for a notepad window to be active or just exist? WinActive or WinExists [size="1"][font="Arial"].[u].[/u][/font][/size]
epicfail Posted September 26, 2009 Author Posted September 26, 2009 lolit dosnt really matter i just put the notepad in there just 4 a demo to see how this works
herewasplato Posted September 26, 2009 Posted September 26, 2009 $init = TimerInit() While 1 If TimerDiff($init) > 600000 Then Exit EndIf If WinActive("Untitled -") Then ExitLoop EndIf sleep(50) WendThen try replacing the code above with:If Not WinWait("Untitled -", "", 60 * 10) Then Exit...or am I missing what you are attempting here? [size="1"][font="Arial"].[u].[/u][/font][/size]
herewasplato Posted September 26, 2009 Posted September 26, 2009 lolit dosnt really matter i just put the notepad in there just 4 a demo to see how this worksnotepad was not part of my question lolololololIt matters as to which function I post in my code back to you. :-) [size="1"][font="Arial"].[u].[/u][/font][/size]
epicfail Posted September 26, 2009 Author Posted September 26, 2009 no i was just trying to get the timer working o the while loop
herewasplato Posted September 26, 2009 Posted September 26, 2009 ... add $init = TimerInit() twice ...yes [size="1"][font="Arial"].[u].[/u][/font][/size]
herewasplato Posted September 26, 2009 Posted September 26, 2009 (edited) Minor thing - you can have "single line" If statementsWhile 1 If TimerDiff($init) > 600000 Then Exit If WinActive("Untitled -") Then ExitLoop Sleep(50) WEnd Edited September 26, 2009 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
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