How can I click 2 times at 2 diff locations based on image?

I have saved 4 images (in-in, in-out, out-in, out-out)

If in-in appears then I need to click (412,59) and (412,59)
If in-out appears then I need to click (412,59) and (512,79)
If out-in appears then I need to click (512,79) and (412,59)
If out-out appears then I need to click (512,79) and (512,79)

Right now I am using the simple if-else loop. But it is time consuming since it has to check for each conition.

I would like to write fast script like…

if imageFound(0,“in-in”,“in-out”,“out,in”,“out-out”)
set CorrectNumber to foundImageNumber()
click item correctNumber of ((412,59 & 412,59),(412,59 & 512,79),(512,79 & 412,59),(512,79 & 512,79))

else
LogError “No image found”

end if

Do you know how I can make my script fast?

Sure, you’re close already. You just need to do two separate Click commands if you want to click twice:

if imageFound(0,"in-in","in-out","out-in","out-out") 
  set CorrectNumber to foundImageNumber() 
  click item correctNumber of ((412,59),(412,59),(512,79),(512,79)) 
  click item correctNumber of ((412,59),(512,79),(412,59),(512,79)) 
else 
  LogError "No image found"
end if 

Does that look like what you want?