shay Posted September 23, 2009 Share Posted September 23, 2009 HI all i use a WinWaitActive with timeout, WinWaitActive("Connect to fs",'',120) because of the big timer i want to display the "TimeOut" waiting to the user so the user will know that the automation is in process. is it possible to show countdown or any other massage during the WinWaitActive, or during the entire script runing? "If the facts don't fit the theory, change the facts." Albert Einstein Link to comment Share on other sites More sharing options...
Mat Posted September 23, 2009 Share Posted September 23, 2009 HI all i use a WinWaitActive with timeout, WinWaitActive("Connect to fs",'',120) because of the big timer i want to display the "TimeOut" waiting to the user so the user will know that the automation is in process. is it possible to show countdown or any other massage during the WinWaitActive, or during the entire script runing? Something like: _WinWaitActiveCountdown ("Untitled - Notepad", "", -1) MsgBox (0, "done", "Window opened in " & @Extended & " milliseconds") Func _WinWaitActiveCountDown ($sTitle, $sText, $nTimeOut = -1) $hTimer = TimerInit () While Not WinActive ($sTitle, $sText) If $nTimeOut = -1 Then Tooltip (Round (TimerDiff ($hTimer) / 1000)) Else Tooltip (($nTimeOut / 1000) - Round (TimerDiff ($hTimer) / 1000)) If (TimerDiff ($hTimer) >= $nTimeOut) Then Return SetError (1, 0, 0) EndIf WEnd Return SetExtended (TimerDiff ($hTimer), 1) EndFunc ; ==> _WinWaitActiveCountDown Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
shay Posted September 23, 2009 Author Share Posted September 23, 2009 Something like: _WinWaitActiveCountdown ("Untitled - Notepad", "", -1) MsgBox (0, "done", "Window opened in " & @Extended & " milliseconds") Func _WinWaitActiveCountDown ($sTitle, $sText, $nTimeOut = -1) $hTimer = TimerInit () While Not WinActive ($sTitle, $sText) If $nTimeOut = -1 Then Tooltip (Round (TimerDiff ($hTimer) / 1000)) Else Tooltip (($nTimeOut / 1000) - Round (TimerDiff ($hTimer) / 1000)) If (TimerDiff ($hTimer) >= $nTimeOut) Then Return SetError (1, 0, 0) EndIf WEnd Return SetExtended (TimerDiff ($hTimer), 1) EndFunc ; ==> _WinWaitActiveCountDown Mat is ther a way to use the "ToolTip" not attached to the cursor but to a fix place on the screen? BTW your script us lots of CPU will running... "If the facts don't fit the theory, change the facts." Albert Einstein Link to comment Share on other sites More sharing options...
jvanegmond Posted September 23, 2009 Share Posted September 23, 2009 is ther a way to use the "ToolTip" not attached to the cursor but to a fix place on the screen? BTW your script us lots of CPU will running... Did you look in the helpfile at the ToolTip page? ToolTip .. I didn't think so. CPU fix: _WinWaitActiveCountdown ("Untitled - Notepad", "", -1) MsgBox (0, "done", "Window opened in " & @Extended & " milliseconds") Func _WinWaitActiveCountDown ($sTitle, $sText, $nTimeOut = -1) $hTimer = TimerInit () While Not WinActive ($sTitle, $sText) If $nTimeOut = -1 Then Tooltip (Round (TimerDiff ($hTimer) / 1000)) Else Tooltip (($nTimeOut / 1000) - Round (TimerDiff ($hTimer) / 1000)) If (TimerDiff ($hTimer) >= $nTimeOut) Then Return SetError (1, 0, 0) EndIf Sleep(50) WEnd Return SetExtended (TimerDiff ($hTimer), 1) EndFunc ; ==> _WinWaitActiveCountDown github.com/jvanegmond Link to comment Share on other sites More sharing options...
shay Posted September 23, 2009 Author Share Posted September 23, 2009 Did you look in the helpfile at the ToolTip page? ToolTip .. I didn't think so. CPU fix: _WinWaitActiveCountdown ("Untitled - Notepad", "", -1) MsgBox (0, "done", "Window opened in " & @Extended & " milliseconds") Func _WinWaitActiveCountDown ($sTitle, $sText, $nTimeOut = -1) $hTimer = TimerInit () While Not WinActive ($sTitle, $sText) If $nTimeOut = -1 Then Tooltip (Round (TimerDiff ($hTimer) / 1000)) Else Tooltip (($nTimeOut / 1000) - Round (TimerDiff ($hTimer) / 1000)) If (TimerDiff ($hTimer) >= $nTimeOut) Then Return SetError (1, 0, 0) EndIf Sleep(50) WEnd Return SetExtended (TimerDiff ($hTimer), 1) EndFunc ; ==> _WinWaitActiveCountDown thanks men (i looked in the help file but didn't figure how to implant in the timeout) still learning! "If the facts don't fit the theory, change the facts." Albert Einstein Link to comment Share on other sites More sharing options...
jvanegmond Posted September 23, 2009 Share Posted September 23, 2009 Ah, no problem. You should have seen my first topics. 8) github.com/jvanegmond Link to comment Share on other sites More sharing options...
Mat Posted September 23, 2009 Share Posted September 23, 2009 Ah that explains it! Manadar gets 50+ posts a day by taking someones function and adding one line I'm not surprised I was stealing cpu, I was just testing the theory, you can probably change the sleep to an even higher value... Glad to see it working! Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
jvanegmond Posted September 23, 2009 Share Posted September 23, 2009 Ah that explains it! Manadar gets 50+ posts a day by taking someones function and adding one line I'm not surprised I was stealing cpu, I was just testing the theory, you can probably change the sleep to an even higher value...Glad to see it working!MatThat doesn't really explain it. And for the record, I did point him to the correct page in the help file that immediately solves his first problem. ; )The credit for the code is all yours! github.com/jvanegmond 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