title: how to use the image search autohotkey function to wait for an image to appear on screen
body: <p>i am new to autohotkey i know very little, i need to make a macro in the company where i work and i need to use autohotkey to make that macro.</p>
  
  <p>What I am wanting to do is this. I need to access a JAVA application that stays on my computer, but this application takes some time to start sometimes it's fast sometimes it's slow I don't know exactly how long it can take to load.</p>
  
  <p>What I need the script to do is wait for an image I captured to appear on screen when the application loads, while that image doesn't look like it waits until it appears on screen.</p>
  
  <p>I researched a lot about autohotkey, and the imagesearch function, but I didn't quite understand how to use it</p>
  
  <pre><code>imagefound := false
  time_loopStart := A_TickCount
  timeout := 6000
  sleep_after_each_imagesearch := 300
  CoordMode, Pixel
  Loop{
       ImageSearch x,y, A_ScreenWidth, A_ScreenHeight, C:\test\Javalogin.png
       if ErrorLevel = 0{
          imagefound := true
          break
    }
    if(A_TickCount - time_loopSart &gt; timeout){
       break
  
    }
    sleep %sleep_after_each_imagesearch%
  }
  MsgBox, I found the picture
  </code></pre>
  
  <p>this script i found on the internet</p>
  
  <p>I accept suggestions if the script needs to be redone etc.</p>
  
  <p>I just need to make the script wait for the image to appear</p>
  
  <p>if you have someone to help I leave my thanks :)</p>