Jump to content

WaitFuncs


this-is-me
 Share

Recommended Posts

This is one of those things it is nice to have in your include directory. Just thought I would post incase someone else needs these functions:

Func HotKeyWaitSet($keys)
    Do
        HotKeySet($keys)
        Sleep(250)
    Until HotKeySet($keys, "Null") = 0
EndFunc

Func HotKeyWaitUnSet($keys)
    Do
        HotKeySet($keys)
        Sleep(250)
    Until HotKeySet($keys, "Null") = 1
    HotKeySet($keys)
EndFunc

Func WinWaitVisible($ttl, $txt)
    Do
        Sleep(250)
    Until BitAND(WinGetState($ttl, $txt), 2)
EndFunc

Func WinWaitInVisible($ttl, $txt)
    Do
        Sleep(250)
    Until Not BitAND(WinGetState($ttl, $txt), 2)
EndFunc

Func ControlWaitEnabled($ttl, $txt, $cls)
   Do
      Sleep(250)
   Until ControlCommand($ttl, $txt, $cls, "IsEnabled", "") = 1
EndFunc

Func ControlWaitDisabled($ttl, $txt, $cls)
   Do
      Sleep(250)
   Until ControlCommand($ttl, $txt, $cls, "IsEnabled", "") = 0
EndFunc

Func ControlWaitVisible($ttl, $txt, $cls)
   Do
      Sleep(250)
   Until ControlCommand($ttl, $txt, $cls, "IsVisible", "") = 1
EndFunc

Func ControlWaitInVisible($ttl, $txt, $cls)
   Do
      Sleep(250)
   Until ControlCommand($ttl, $txt, $cls, "IsVisible", "") = 1
EndFunc

Func ControlWaitText($ttl, $txt, $cls)
   Do
        Sleep(250)
    Until ControlGetText($ttl, $txt, $ctrl) = $txt
EndFunc

Func FileWaitExists($pth)
   Do
      Sleep(250)
   Until FileExists($pth)
EndFunc

Func Null()
EndFunc
Who else would I be?
Link to comment
Share on other sites

For inspiration only... :)

Func ControlWaitText($title, $text, $class, $timeout)
   Local $timer = TimerInit(),$rval = 0
   while 1
      if ControlGetText($title, $text, $class) == $text Then
         $rval = 1
         Exitloop
      EndIf
      if TimerDiff($timer) >= $timeout * 1000 Then ExitLoop
      sleep(250)
   WEnd
   Return $rval
EndFunc

(untested)

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
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...