IAMK Posted November 22, 2018 Posted November 22, 2018 I hacked together a script for work today, and upon execution of _ImageSearch() it turns out the same image was slightly different in different places, so I ended up nesting 5 ifs together... If($search = 1) Then ;If image is found. MouseClick("Primary", $x, $y, 1, 0) Else $search = _ImageSearch("CheckedBox2.png", 1, $x, $y, 0, 0) If($search = 1) Then ;If image is found. MouseClick("Primary", $x, $y, 1, 0) Else $search = _ImageSearch("CheckedBox3.png", 1, $x, $y, 0, 0) If($search = 1) Then ;If image is found. MouseClick("Primary", $x, $y, 1, 0) Else $search = _ImageSearch("CheckedBox4.png", 1, $x, $y, 0, 0) If($search = 1) Then ;If image is found. MouseClick("Primary", $x, $y, 1, 0) Else $search = _ImageSearch("CheckedBox5.png", 1, $x, $y, 0, 0) If($search = 1) Then ;If image is found. MouseClick("Primary", $x, $y, 1, 0) EndIf EndIf EndIf EndIf EndIf Looking back on the code now, I could do the entire thing with a tolerance in the last 2 parameters. However, is there any general guideline on how much tolerance to set? I can't seem to find anything on this topic for AutoIT.
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