Please please AHK gods help me out.
I tried to type of scripts, one an copy/pasta from the original gdip_pixelsearch thread on the forums and it doesn't even work. I assume it might have something to do with the colour formatting maybe?
Code: Select all
#Include Gdip_All.ahk
#Include Gdip_PixelSearch.ahk
F1::
pToken := Gdip_Startup()
vPosX := 0, vPosY := 0
vPosW := 1920, vPosH := 1080
vImgPos := Format("{}|{}|{}|{}", vPosX, vPosY, vPosW, vPosH)
pBitmap := Gdip_BitmapFromScreen(vImgPos)
if !Gdip_PixelSearch(pBitmap, ARGB := 0x4294967295, x, y)
MsgBox, Pixel %ARGB% found at (%x%, %y%)
else
MsgBox, Pixel %ARGB% not found
Gdip_DisposeImage(pBitmap)
Gdip_Shutdown(pToken)
return
Code: Select all
#Include Gdip_All.ahk
F1::
pToken := Gdip_Startup()
pBitmap := Gdip_CreateBitmapFromFile("image.png")
if !Gdip_PixelSearch(pBitmap, ARGB := 0xff0118d9, x, y)
MsgBox, Pixel %ARGB% found at (%x%, %y%)
else
MsgBox, Pixel %ARGB% not found
Gdip_DisposeImage(pBitmap)
Gdip_Shutdown(pToken)
return
;#####################################################################################
Gdip_PixelSearch(pBitmap, ARGB, ByRef x, ByRef y)
{
static _PixelSearch
if !_PixelSearch
{
MCode_PixelSearch := "8B44241099535583E2035603C233F6C1F80239742418577E388B7C24148B6C24248B5424188D1C85000000008D64240033C085"
. "D27E108BCF3929743183C00183C1043BC27CF283C60103FB3B74241C7CDF8B4424288B4C242C5F5EC700FFFFFFFF5DC701FFFFFFFF83C8FF5BC38B4C2"
. "4288B54242C5F890189325E5D33C05BC3"
VarSetCapacity(_PixelSearch, StrLen(MCode_PixelSearch)//2)
Loop % StrLen(MCode_PixelSearch)//2 ;%
NumPut("0x" SubStr(MCode_PixelSearch, (2*A_Index)-1, 2), _PixelSearch, A_Index-1, "char")
}
Gdip_GetImageDimensions(pBitmap, Width, Height)
if !(Width && Height)
return -1
if (E1 := Gdip_LockBits(pBitmap, 0, 0, Width, Height, Stride1, Scan01, BitmapData1))
return -2
x := y := 0
E := DllCall(&_PixelSearch, "uint", Scan01, "int", Width, "int", Height, "int", Stride1, "uint", ARGB, "int*", x, "int*", y)
Gdip_UnlockBits(pBitmap, BitmapData1)
return (E = "") ? -3 : E
}