Jump to content

Recommended Posts

Posted (edited)

Hi everyone.

I made a wait function which can be utilized in any situation where windows may change, such as opening a program like excel, waiting on a window to pop up, etc. I was just wondering if this code I've devised is way too convoluted for the task, is there a simpler way? or will this suffice.

Func wait($xc1 = 0, $yc1 = 0, $xc2 = 0, $yc2 = 0, $colour = "", $shade = 1, $outWait = 500)
   Global $waited = 0
      tt("We are waiting...")
      wait2($xc1, $yc1, $xc2, $yc2, $colour, $shade)
         If $waited = 0 Then ; if we looked too soon, try again
            wait2($xc1, $yc1, $xc2, $yc2, $colour, $shade)
         EndIf
      Sleep($outWait) ; Give it some time to do something
EndFunc

Func wait2($xc1, $yc1,$xc2, $yc2, $colour, $shade)
   $waited = PixelSearch($xc1, $yc1, $xc2, $yc2, $colour, $shade) ; look here
EndFunc

EDIT: This is the revised code, however my question still stands, would this be a good approach to this kind of function?

Edited by GeeEssBeeEss
Didn't need some of the code due to If statement (some errors as well)

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
×
×
  • Create New...