If you haven't read my first post to to it

Ok like always you need this 2 programs.
Ok, now you will need to download the R32.zip file on this post. So now make a new project with ScTE, and ad all the text from 32.txt on the top of the new project. This code makes you work with Search on your screen for images. Her's the code also.
Ok make a new folder on your desktop and add a new folder in it call it img and add the ImageSearchDLL.dll in the folder (not in the img folder.)Quote:
#Region ### START ImageSearch ###
Func _ImageSearch($findImage,$resultPosition,ByRef $x, ByRef $y,$tolerance)
return _ImageSearchArea($findImage,$resultPosition,0,0,@D esktopWidth,@DesktopHeight,$x,$y,$tolerance)
EndFunc
Func _ImageSearchArea($findImage,$resultPosition,$x1,$y 1,$right,$bottom,ByRef $x, ByRef $y, $tolerance)
if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
$result = DllCall("ImageSearchDLL.dll","str","ImageSearch"," int",$x1,"int",$y1,"int",$right,"int",$bottom,"str ",$findImage)
if $result[0]="0" then return 0
$array = StringSplit($result[0],"|")
$x=Int(Number($array[2]))
$y=Int(Number($array[3]))
if $resultPosition=1 then
$x=$x + Int(Number($array[4])/2)
$y=$y + Int(Number($array[5])/2)
endif
return 1
EndFunc
Func _WaitForImageSearch($findImage,$waitSecs,$resultPo sition,ByRef $x, ByRef $y,$tolerance)
$waitSecs = $waitSecs * 1000
$startTime=TimerInit()
While TimerDiff($startTime) < $waitSecs
sleep(100)
$result=_ImageSearch($findImage,$resultPosition,$x , $y,$tolerance)
if $result > 0 Then
return 1
EndIf
WEnd
return 0
EndFunc
Func _WaitForImagesSearch($findImage,$waitSecs,$resultP osition,ByRef $x, ByRef $y,$tolerance)
$waitSecs = $waitSecs * 1000
$startTime=TimerInit()
While TimerDiff($startTime) < $waitSecs
for $i = 1 to $findImage[0]
sleep(100)
$result=_ImageSearch($findImage[$i],$resultPosition,$x, $y,$tolerance)
if $result > 0 Then
return $i
EndIf
Next
WEnd
return 0
EndFunc
#EndRegion ### START ImageSearch ###

Ok so make a picture of somthing you want the bot is going to click on if is there. so this is my image, also add it to the img folder.

ok now to the coding part. This is a code to make the program read and see where the image is on your desktop, X Y angels.
Then we will add a hot key to terminate the bot. This will terminate the bot when u press F1.Quote:
$x1=0
$y1=0
HotKeySet("{F1}", "Terminate")
Now we will need to open and close a loop.
Ok now in the loop we will need to add the code that fiends the image and clicks on itQuote:
While 1
WEnd
Here you will make a variable that makes the program know to what to search on. Also adding the posiion on X,Y angels.Quote:
$result = _ImageSearch("img/2.bmp",1,$x1,$y1,1)
Then we will need to make a IF sate that will make the movement and click or what ever.
So now the script for that image will move and click on it "LEFT CLICK WITH THE MOUSE."Quote:
if $result=1 Then
MouseMove($x1,$y1,3)
MouseClick("left",$x1,$y1,1,3)
MouseClick("left",$x1,$y1,1,3)
EndIf
now out side of the loop we will need to finish the terminate kotkey script so add this code. This will me called when you press the F1 button
Quote:
Func Terminate()
Exit 0
EndFunc
ALERT, THE IMAGE MOST BE .BMP FORMAT.
FULL CODE HERE
Quote:
#Region ### START ImageSearch ###
Func _ImageSearch($findImage,$resultPosition,ByRef $x, ByRef $y,$tolerance)
return _ImageSearchArea($findImage,$resultPosition,0,0,@D esktopWidth,@DesktopHeight,$x,$y,$tolerance)
EndFunc
Func _ImageSearchArea($findImage,$resultPosition,$x1,$y 1,$right,$bottom,ByRef $x, ByRef $y, $tolerance)
if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
$result = DllCall("ImageSearchDLL.dll","str","ImageSearch"," int",$x1,"int",$y1,"int",$right,"int",$bottom,"str ",$findImage)
if $result[0]="0" then return 0
$array = StringSplit($result[0],"|")
$x=Int(Number($array[2]))
$y=Int(Number($array[3]))
if $resultPosition=1 then
$x=$x + Int(Number($array[4])/2)
$y=$y + Int(Number($array[5])/2)
endif
return 1
EndFunc
Func _WaitForImageSearch($findImage,$waitSecs,$resultPo sition,ByRef $x, ByRef $y,$tolerance)
$waitSecs = $waitSecs * 1000
$startTime=TimerInit()
While TimerDiff($startTime) < $waitSecs
sleep(100)
$result=_ImageSearch($findImage,$resultPosition,$x , $y,$tolerance)
if $result > 0 Then
return 1
EndIf
WEnd
return 0
EndFunc
Func _WaitForImagesSearch($findImage,$waitSecs,$resultP osition,ByRef $x, ByRef $y,$tolerance)
$waitSecs = $waitSecs * 1000
$startTime=TimerInit()
While TimerDiff($startTime) < $waitSecs
for $i = 1 to $findImage[0]
sleep(100)
$result=_ImageSearch($findImage[$i],$resultPosition,$x, $y,$tolerance)
if $result > 0 Then
return $i
EndIf
Next
WEnd
return 0
EndFunc
#EndRegion ### START ImageSearch ###
$x1=0
$y1=0
HotKeySet("{F1}", "Terminate")
While 1
$result = _ImageSearch("img/2.bmp",1,$x1,$y1,1)
if $result=1 Then
MouseMove($x1,$y1,3)
MouseClick("left",$x1,$y1,1,3)
EndIf
WEnd
Func Terminate()
Exit 0
EndFunc
Have fun. Remember to press thanks and visit my site.






