Wildpal Posted July 21, 2015 Posted July 21, 2015 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 EndFuncresult =_ImageSearch("main.png",1 ,$x1, $y1, 0)$result =_ImageSearch("main.png",1 ,^ ERROR
kaisies Posted July 22, 2015 Posted July 22, 2015 (edited) Read that a little wrong on my phone. Try defining $x1 and $y1 before using them. AlsoMouseClick("LEFT",$x ,$y)Should be MouseClick("LEFT",$x1 ,$y1) Edited July 22, 2015 by kaisies
Wildpal Posted July 22, 2015 Author Posted July 22, 2015 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 EndFuncif $result[0]="0" then return 0
kaisies Posted July 23, 2015 Posted July 23, 2015 Unless you include the error you are receiving, I can only guess what your problem is. My guess right now is you don't know how to read errors.
guestscripter Posted August 8, 2015 Posted August 8, 2015 Something like this would have helped me so much:Hope it gives others a leg up! ImageSearch15.au3 featuring _ImageSearchStartup() and _ImageSearchShutdown()
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