ardavirus Posted November 5, 2010 Posted November 5, 2010 (edited) I am trying to make PixelGetColor to read from a bitmap I have saved on clipboard.Here it is my logic and testing.-I maximize an empty notepad.-Then I screen capture a bitmap of 5x5 near the center (all pixels should be 0xFFFFFF).-I use the Bitmap handle ($hSC) inside the PixelGetColor to measure the upper left pixel of my previous capture.The problem is that instead of getting 0xFFFFFF in my output msgBox which is the first pixel of my 5x5 capture, I get 0x86A4D5 which is the first pixel of the entire screen. Here is my code:#include <ScreenCapture.au3> If WinExists("Untitled - Notepad") Then WinActivate("Untitled - Notepad") Else MsgBox(0,"Not found","Notepad is not running") EndIf Sleep(2000) Local $hSC = _ScreenCapture_Capture("",400,400,405,405,False) Local $color = PixelGetColor (1,1,$hSC) MsgBox(0,"The Hex color is",Hex($color,6)) _WinAPI_DeleteObject($hSC)Any hint to help me move on will be much appreciated. Thank you for your time to read this. Edited November 5, 2010 by ardavirus
JohnOne Posted November 5, 2010 Posted November 5, 2010 Direct from the helpfileIf FileName is blank, thisfunction will capture the screen and return a HBITMAP handle to the bitmap image.You really should read the helpfile on a function you are having trouble with. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
ardavirus Posted November 5, 2010 Author Posted November 5, 2010 You really should read the helpfile on a function you are having trouble with. In fact that was the idea, having the handle of the BITMAP that is saved on the clipboard, from my inexprient point of view, was the best thing. I use the BITMAP directly from clipboard (using it's handle that i presume points there) and then i drop the handle with _WinAPI_DeleteObject. Doing some thinking between posts I figured that I might was wrong considering the BITMAP on clipboard an object, but saving the bitmap somewhere else then get it's handle seems the same thing if not more complicated. I really can't think of a solution on how to proceed from this point, just need a minor hint to get me to right direction. And I am trying to read everything there is, and try everything I can think, before I post here, it is just that sometimes you need the 10% of someone's else brain. My question maybe is dumb but your answer is far from constructive dear JohnOne. Cheers!
Developers Jos Posted November 5, 2010 Developers Posted November 5, 2010 @ardavirus, Just give up and move on to a forum that isn't against bots. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Recommended Posts