Get Pixel Color
Keywords: Pixel color with mouse over
Question:
Is there a WinBatch function to retrieve the color of a pixel???I need to "scan" the screen and move the mouse over a specific color.
Answer:
No function, but here is how it is done...gdidll=StrCat(DirWindows(1),"GDI32.DLL") userdll=StrCat(DirWindows(1),"USER32.DLL") hdc=DllCall(userdll,long:"GetDC",lpnull) BoxOpen("PixelInfo","") while 1 mouse=MouseInfo(3) x=ItemExtract(1,mouse," ") y=ItemExtract(2,mouse," ") pixel=DllCall(gdidll,long:"GetPixel",long:hdc,long:x,long:y) Red = (pixel) & 255 Green=(pixel >> 8) & 255 Blue=(pixel >> 16) & 255 BoxText(strcat("X=",x,@crlf,"Y=",y,@crlf,"Pixel=",red," ",green," ",blue)) TimeDelay(1) endwhile :CANCEL DllCall(userDLL,long:"ReleaseDC",lpnull,long:hdc) Message("OK","On Exit")
Article ID: W14460Filename: Get Pixel Color.txt