Sign in to follow this  
Followers 0
shay

display "WinWaitActive " timeout

8 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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! :D


"If the facts don't fit the theory, change the facts." Albert Einstein

Share this post


Link to post
Share on other sites

Ah that explains it! Manadar gets 50+ posts a day by taking someones function and adding one line :D 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

Share this post


Link to post
Share on other sites

Ah that explains it! Manadar gets 50+ posts a day by taking someones function and adding one line :D 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

That 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!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0