jvanegmond Posted January 31, 2008 Posted January 31, 2008 (edited) Description:This is an UDF to get a pixel from the memory. You first take a screenshot into memory, then use the pixel grabbing function as many times as you like, then call the destroy function. Please note that all of these functions are designed towards maximum performance. This means that nothing is actually released automatically so that the end-user can keep maximum control over what happens.Author:Original method: GreenseedUDF: ManadarDownload:Example:#include <_PixelGetColor.au3> #include <Misc.au3> $hDll = DllOpen("gdi32.dll") $vDC = _PixelGetColor_CreateDC($hDll) $vRegion = _PixelGetColor_CaptureRegion($vDC, 0,0,@DesktopWidth,@DesktopHeight,$hDll) ; click left mouse button to exit While Not _IsPressed(0x01) $aPos = MouseGetPos() $sColor = _PixelGetColor_GetPixel($vDC, $aPos[0],$aPos[1], $hDll) ToolTip("The color under your mouse is: " & $sColor, $aPos[0]+3, $aPos[1]+3, "_PixelGetColor_GetPixel return",$hDll) WEnd _PixelGetColor_ReleaseRegion($vRegion) _PixelGetColor_ReleaseDC($vDC,$hDll) DllClose($hDll)Benefits of using this method:It's faster for capturing more pixels at once.All the pixels can be captured at once, then read at your convenience anywhere in the script. You can capture multiple screens at once and compare them.No problems with Vista (Aero) or Windows 7.Drawbacks:It's harder to implement._PixelGetColor.au3Example.au3 Edited April 16, 2012 by Manadar Xandy 1 github.com/jvanegmond
NeoFoX Posted January 31, 2008 Posted January 31, 2008 Nice script I'll definitly gonna use this one for my image-to-text prog. But... you should alter your example script which is in your post between the codebox tags... because this one isn't working. You haven't used any vars their on which screen to use the pixelgetcolor.. Neo [center][font="Arial"]--- The Neo and Only --- [/font][font="Arial"]--Projects---[/font]Image to Text converterText to ASCII converter[/center]
jvanegmond Posted January 31, 2008 Author Posted January 31, 2008 Nice script I'll definitly gonna use this one for my image-to-text prog.But... you should alter your example script which is in your post between the codebox tags... because this one isn't working.You haven't used any vars their on which screen to use the pixelgetcolor..NeoThanks, I forgot to remove it. It was on of the older versions until I realized to not use any global variables in the include. github.com/jvanegmond
marscom Posted February 1, 2008 Posted February 1, 2008 (edited) Amazing. Just amazing, I needed to do a PixelGetColour for about 190 (x,y) positions, was taking about 5-6 secs using the AutoIt function.This is less than a second - brilliant.One thing, I suggest creating some way of getting it to grab only a specific client window or window area, I fixed the problem by getting the window position from Au3Info and setting it up like this, with $win_title being your windows title.$windowinfo = WinGetPos ( $win_title) $vRegion = _PixelGetColor_CaptureRegion($vDC, $windowinfo[0],$windowinfo[1],@DesktopWidth,@DesktopHeight)oÝ÷ Ù8b³¥ÚÚrKa{§v)¢ÈÚÚ'(+i·ë¢kazÚ)çí¡ûa{§vuا©è}û¶X¤zØb±«¢+ØÀÌØíÙI¥½¸ô}A¥á±Ñ ½±½É} ÁÑÕÉI¥½¸ ÀÌØíÙ°ÀÌØíÝ¥¹½Ý¥¹½lÁt¬Ì°ÀÌØíÝ¥¹½Ý¥¹½lÅt¬È̱ÍѽÁ]¥Ñ ±ÍѽÁ!¥¡Ð¤With the offsets being - $windowinfo[0]+3,$windowinfo[1]+23Will fix it to client pixel co-ord mode for vista, not sure what the offsets are for XP.Regardless, brilliant work, my Script wouldnt be working without it biggrin.gif Edited February 1, 2008 by marscom
JRSmile Posted February 1, 2008 Posted February 1, 2008 pritty good work manadar *handclap* but is it fast enough to capture for example a movie or a game? i suppose that taking a screenshot takes some time and calculationg where the pixels are less time, so now the screenshot function is the bottleneck? $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
BillLuvsU Posted February 1, 2008 Posted February 1, 2008 (edited) Somebody needs to make a Guitar Hero bot with this. =]]] I could write it pretty easily but my computer can't run the game If somebody were to get me the pixel coords and hex colors of the note however, I could write the routines petty easily/quickly. Edit: I would also need what keys to send to for the frets and strum, etc. Edited February 1, 2008 by fear1313 [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw
jvanegmond Posted February 2, 2008 Author Posted February 2, 2008 @JRSmile, I am not quite sure where the bottle neck is currently... It's probably at AutoIt's limitation to call these DLL's very fast since the other components are so fast.Somebody needs to make a Guitar Hero bot with this. =]]] I could write it pretty easily but my computer can't run the game If somebody were to get me the pixel coords and hex colors of the note however, I could write the routines petty easily/quickly.Edit: I would also need what keys to send to for the frets and strum, etc.http://www.autoitscript.com/forum/index.php?showtopic=62681 github.com/jvanegmond
GaryFrost Posted February 2, 2008 Posted February 2, 2008 @JRSmile, I am not quite sure where the bottle neck is currently... It's probably at AutoIt's limitation to call these DLL's very fast since the other components are so fast.http://www.autoitscript.com/forum/index.php?showtopic=62681 If your going to repeatedly call the dll, you might want to add a optional param of the dll, default to "dll.name" that way you can open with DllOpen and pass the handle in that should speed it up some. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
GaryFrost Posted February 5, 2008 Posted February 5, 2008 (edited) @JRSmile, I am not quite sure where the bottle neck is currently... It's probably at AutoIt's limitation to call these DLL's very fast since the other components are so fast.http://www.autoitscript.com/forum/index.php?showtopic=62681 Still sick, but took a look at it, see what you think of the modifications: PixelGetColor.au3, modified example: _PixelGe...GetPixel.au3Each header that has a Yes for Example is what would be expected to have examples for being all but 1 function was used in your example.Edit: Removed Attachments Edited February 8, 2008 by GaryFrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
jvanegmond Posted February 6, 2008 Author Posted February 6, 2008 (edited) Still sick, but took a look at it, see what you think of the modifications: , modified example: Each header that has a Yes for Example is what would be expected to have examples for being all but 1 function was used in your example.Very good! I like what you did with all the _WinAPI functions, I had no idea. I noticed you didn't use $hDll in the _PixelGetColor_GetPixel function, but I see you meant to use it in the _PixelGetColor_GetPixelRaw function. I have uploaded these files in the initial post. I still have to update the headers now and write an example for _PixelGetColor_GetPixelRaw. Edited February 6, 2008 by Manadar github.com/jvanegmond
GaryFrost Posted February 6, 2008 Posted February 6, 2008 Very good! I like what you did with all the _WinAPI functions, I had no idea. I noticed you didn't use $hDll in the _PixelGetColor_GetPixel function, but I see you meant to use it in the _PixelGetColor_GetPixelRaw function.I have uploaded these files in the initial post. I still have to update the headers now and write an example for _PixelGetColor_GetPixelRaw.I meant to pass it on in the Call to _PixelGetColor_GetPixelRaw from _PixelGetColor_GetPixel, missed adding that parameter in. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
BillLuvsU Posted February 7, 2008 Posted February 7, 2008 http://www.autoitscript.com/forum/index.php?showtopic=62681 wow... I evan posted in that topic... My brain is dieing more and more every day... [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw
jvanegmond Posted March 5, 2008 Author Posted March 5, 2008 Can it work on minimized windows?Only if you screenshot the window first, and then minimize it. github.com/jvanegmond
raquien Posted May 9, 2008 Posted May 9, 2008 hi manadar, would like to give this a try but i got '404' on the link.
Uriziel01 Posted May 9, 2008 Posted May 9, 2008 I really need this function now, and I have no time to do it myself. Please upload it again Madanar Thx if you will do it !! p.s-Oh! and also big THX for making all this stuff
jvanegmond Posted May 11, 2008 Author Posted May 11, 2008 I'm uploading this again once I have the files back. Currently lost them somewhere along the process of switching PCs. github.com/jvanegmond
jvanegmond Posted May 13, 2008 Author Posted May 13, 2008 I have it uploaded (Thanks to NeoFoX) but the example still is missing. I'm waiting for Gary to reply to this thread, see if he still has a version of the example. github.com/jvanegmond
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now