Hi
alesyt0h!
Sure you could do that with a few pretty simple extra steps. You can first create the image with GDI+ then use FindClick with that image once you have it. It would look something like this:
Code: Select all
; The image you are looking for will be initially found at (100, 200) relative to the screen and be 10x10 pixels
ImageX = 100
ImageY = 200
ImageW = 10
ImageH = 10
TempFile := A_Temp "\Temporary_Image.png"
Gdip_Screenshot(TempFile, ImageX, ImageY, ImageW, ImageH)
FindClick(TempFile)
Return
;============================================ Functions =============================================
Gdip_Screenshot(OutputPath="", x="", y="", w="", h="") ; Just a simplified function for taking a screenshot using GDI+
{
If (OutputPath = "")
OutputPath := A_Desktop "\" A_Now ".png"
If (x = "")
x := 0, y := 0, w := A_ScreenWidth, h := A_ScreenHeight
IfWinExist, ahk_id %x%
WinGetPos, x, y, w, h, ahk_id %x%
FileDelete, %OutputPath%
pToken := Gdip_Startup()
pBitmap := Gdip_BitmapFromScreen(x "|" y "|" w "|" h)
Gdip_SaveBitmapToFile(pBitmap, OutputPath)
Gdip_DisposeImage(pBitmap)
Gdip_Shutdown(pToken)
Return OutputPath
}
#Include, Gdip.ahk ; get it at https://github.com/berban/Gdip/blob/master/Gdip.ahk
#Include, FindClick.ahk
I couldn't find a copy of the version of Gdip.ahk that I use online, so I uploaded it to my Github:
https://github.com/berban/Gdip/blob/master/Gdip.ahk
My question, though, is how are you going to be able to find the image the first time in order to take the screenshot? i.e. how will you know the values of ImageX, ImageY, etc in the code above?