Jump to content

display "WinWaitActive " timeout


shay
 Share

Recommended Posts

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

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

Link to comment
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

Link to comment
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
Link to comment
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

Link to comment
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!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...