The basic idea of this program is to be able to do an ImageSearch on the cursor.
For some reason the transparency is not working for ImageSearch.
I have taken a screenshot of the cursor for arrow.png and then turned the background red so that I can search for the arrow on any background.
The problem is that I get an "Image Found" message only when the arrow is on the original background that I took the screenshot with, no other backgrounds match.
Does anyone know what I am doing wrong with ImageSearch? I have tried increasing the values of *n but that really does nothing.
The image I am searching for is:
ScreenCapture.ahk comes from
http://www.autohotkey.com/forum/topic18146.html
The program I am using:
Code:
#Include ScreenCapture.ahk
CoordMode Mouse, Screen
CoordMode Pixel, Screen
Gui +LastFound +AlwaysOnTop -Caption +ToolWindow
Gui, Add, Picture, x35 h35 vPic, image.jpg
Gui, Add, Text, vMyText cLime, XXXXXXXXXXXXXXXXXXXX
SetTimer, UpdateOSD, 500
Gosub, UpdateOSD
Gui, Show, x0 y400 NoActivate
return
UpdateOSD:
MouseGetPos x, y
x1 := x - 5
x2 := x + 30
y1 := y - 5
y2 := y + 30
rect = %x1%,%y1%,%x2%,%y2%
CaptureScreen(rect,True, "image.jpg")
GuiControl,, Pic, *w35 *h35 image.jpg
ImageSearch px, py, 0, 0, A_ScreenWidth, A_ScreenHeight, *Trans0xFF0000 *n150 arrow.png ;try increasing the value of n
if ErrorLevel = 2
msg = No search performed
else if ErrorLevel = 1
msg = Image not found
else
msg = Image found
GuiControl,, MyText, %msg%
return