GeeEssBeeEss Posted November 29, 2016 Share Posted November 29, 2016 (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 November 29, 2016 by GeeEssBeeEss Didn't need some of the code due to If statement (some errors as well) Link to comment Share on other sites More sharing options...
GeeEssBeeEss Posted November 29, 2016 Author Share Posted November 29, 2016 I just realized.. if I'm going to use the if statement.. I really don't need the while loop then. lol 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