Jump to content

Image Search


Recommended Posts

Im new to autoit and can´t get image search to work.

#include <ImageSearch.au3>

HotKeySet("{ESC}", "Terminate")
HotKeySet("!a", "Start")

MsgBox(0, "Starting Up", "Starting, use ESCAPE to quit, and Alt + A to start searching.")

While 1
   sleep(1)
WEnd

Func Start()
   While 1
      $result =_ImageSearch("main.png",1 ,$x1, $y1, 0)
      If $result= 1 Then
         MouseClick("LEFT",$x ,$y)
         sleep(500)
      EndIf
   WEnd
EndFunc

Func Terminate()
   exit 1
EndFunc

result =_ImageSearch("main.png",1 ,$x1, $y1, 0)
$result =_ImageSearch("main.png",1 ,^ ERROR

Link to comment
Share on other sites

Thank you for the help but now a new problem appeared.

#include <ImageSearch.au3>

HotKeySet("{ESC}", "Terminate")
HotKeySet("!a", "Start")

MsgBox(0, "Starting Up", "Starting, use ESCAPE to quit, and Alt + A to start searching.")

$x1 = 0
$y1 = 0

While 1
   sleep(1)
WEnd

Func Terminate()
   exit 1
EndFunc

Func Start()
   While 1
      $result =_ImageSearch("main.png",1 ,$x1, $y1, 0)
      If $result = 1 Then
         MouseClick("LEFT",$x1 ,$y1)
         sleep(500)
      EndIf
   WEnd
EndFunc

if $result[0]="0" then return 0

Link to comment
Share on other sites

  • 3 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...