Sign in to follow this  
Followers 0
twokdavey

Image search help

3 posts in this topic

Here is my code so far

#include <ImageSearch.au3>

HotKeySet("`", "Start")
$y = 0
$x = 0

Func start()
   $Search = _ImageSearch('Search.bmp', 0, $x, $y, 0)
If $search = 1 Then
MouseMove($x, $y, 10)
EndIf
EndFunc

while 1
sleep(100)
WEnd

 I want this to actually keep looking for the image in a loop, I have tried a few ways so i deleted my attempts at the loop and let you guys take a look at it :)

On a side note, I want this to search my 2nd monitor(left of my main monitor) would i put my numbers negative because as of now it only works on my main monitor.

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

All I did below was fix your code, add a more performance-friendly sleep rate, and put the main function in the while loop... and add a more useful HotKey ... "End". Pressing the End key will now stop the script, because a endless while loop + mouse movements + very low sleep time = bad. (You won't be able to stop it, even when you want.)

#include <ImageSearch.au3>
HotKeySet("{END}", "_End")

while 1
   start()
   sleep(250)
WEnd

Func start()
   $y = 0
   $x = 0
   $Search = _ImageSearch('Search.bmp', 0, $x, $y, 0)
   If $search = 1 Then
 MouseMove($x, $y, 10)
   EndIf
EndFunc

Func _End()
   Exit
EndIf
Edited by Andreu

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0