undefinedspace Posted June 8, 2014 Share Posted June 8, 2014 I need a better PixelGetColor(). Something that tests an area rather than one pixel and some shades different than said color. Is PixelSearch() If not @error then the best way? using @error like this wont break something? Link to comment Share on other sites More sharing options...
BrewManNH Posted June 8, 2014 Share Posted June 8, 2014 What exactly are you looking for it to do, that way we can figure out what it is you need to use to get there. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
undefinedspace Posted June 9, 2014 Author Share Posted June 9, 2014 For any window that resizes internal content I could only figure out a way to test with getpixelcolor() that was unreliable. I am sure this is a common problem. Link to comment Share on other sites More sharing options...
Solution junkew Posted June 10, 2014 Solution Share Posted June 10, 2014 search in the forum for keywords like: findbmp imagesearch bmpsearch bitblt gdi opencv exact pixelmatching: '?do=embed' frameborder='0' data-embedContent>> undefinedspace 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Bert Posted June 10, 2014 Share Posted June 10, 2014 For any window that resizes internal content I could only figure out a way to test with getpixelcolor() that was unreliable. I am sure this is a common problem. Have you thought oif hooking directly into the control? That way it makes no difference what size the window is. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
undefinedspace Posted June 13, 2014 Author Share Posted June 13, 2014 (edited) #include <Debug.au3> _DebugSetup() call(testpixelsearch()) Func testpixelsearch() local $aarray= MouseGetPos() local $color= hex(PixelGetColor($aarray[0] , $aarray[1])) local $shadecycle=1 while (0=PixelSearch($aarray[0]-5,$aarray[1]-5,$aarray[0]+5,$aarray[1]+5,$color,$shadecycle)) $shadecycle=$shadecycle+1 _DebugOut($shadecycle & ", " & $color & ", " & $aarray[0] & ", " & $aarray[1]) WEnd Endfunc Sometimes finds in one iteration sometimes in 40 sometimes in 249. Anything wrong with my code? How does pixelsearch work exactly? Same color gets same results. Edited June 13, 2014 by undefinedspace Link to comment Share on other sites More sharing options...
Bert Posted June 13, 2014 Share Posted June 13, 2014 I'll ask again - Have you thought of hooking directly into the control? That way it makes no difference what size the window is. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
bootybay Posted June 13, 2014 Share Posted June 13, 2014 (edited) PixelSearch is using an DEC value as color afaik. But yours is HEX. #include <Debug.au3> _DebugSetup() call(testpixelsearch()) Func testpixelsearch() Local $aarray = MouseGetPos() Local $color = PixelGetColor($aarray[0], $aarray[1]) Local $shadecycle = 1 Do PixelSearch($aarray[0] - 5, $aarray[1] - 5, $aarray[0] + 5, $aarray[1] + 5, $color, $shadecycle) If @error = 0 Then ExitLoop $shadecycle += 1 Until 1 _DebugOut($shadecycle & ", " & $color & ", " & $aarray[0] & ", " & $aarray[1]) EndFunc ;==>testpixelsearch This works like a charm for me. Always on the first shadecycle whereever my mouse hovering over. Edited June 13, 2014 by bootybay undefinedspace 1 Link to comment Share on other sites More sharing options...
BrewManNH Posted June 13, 2014 Share Posted June 13, 2014 I feel like I repeat this about twice a month lately. Hex numbers and Decimal numbers are identical, they're just different ways to present the exact same information. If you search for the value 0x0000FF or the value 255, as long as you treat them both as numbers, you'll find your match. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
undefinedspace Posted June 13, 2014 Author Share Posted June 13, 2014 (edited) Thanks BB. Two programing tips AND your code works perfect! Why? Its not the hex. While we wait for me to come up with new and exciting bizarre behavior, is there any way to get '?do=embed' frameborder='0' data-embedContent>> FastFind installed in Autoit properly or should i just keep a copy of everything in a folder with each new script? '?do=embed' frameborder='0' data-embedContent>> worked too. Edit: BB is wrong. im stupid for not checking right away Edited June 14, 2014 by undefinedspace Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted June 14, 2014 Share Posted June 14, 2014 is there any way to get '?do=embed' frameborder='0' data-embedContent>> FastFind installed in Autoit properly or should i just keep a copy of everything in a folder with each new script? You can create a custom Include directory for the include.au3 http://www.autoitscript.com/wiki/Adding_UDFs_to_AutoIt_and_SciTE You'll still need to copy the dll to each of your scripts, there's no (good) way around that. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
jsteng Posted June 14, 2014 Share Posted June 14, 2014 You are trying to search for a color under the mouse for a match within an area 10x10 centered under the mouse shouldnt that always be TRUE? but bootybay wrote it much cleaner. check how he did the error checking vs how ou did it. Link to comment Share on other sites More sharing options...
undefinedspace Posted June 14, 2014 Author Share Posted June 14, 2014 (edited) #include <Debug.au3> _DebugSetup() call(testpixelsearch()) Func testpixelsearch() Local $aarray = MouseGetPos() Local $color = hex( PixelGetColor($aarray[0], $aarray[1])) Local $shadecycle = 1 Do _DebugOut($shadecycle & ", " & $color & ", " & $aarray[0] & ", " & $aarray[1]) PixelSearch($aarray[0] - 50, $aarray[1] - 50, $aarray[0] + 50, $aarray[1] + 50, $color, $shadecycle) ;If @error = 0 Then ExitLoop $shadecycle += 1 Until 1 _DebugOut($shadecycle & ", " & $color & ", " & $aarray[0] & ", " & $aarray[1]) EndFunc ;==>testpixelsearch when exitloop line is commented until still runs only once. need something like until (false) then everything except pixelsearch works like planned. junkew helped but in the end all was solved by googlefu. Edited June 15, 2014 by undefinedspace Link to comment Share on other sites More sharing options...
BrewManNH Posted June 14, 2014 Share Posted June 14, 2014 Do loops will run at least once until the Until statement equals True, in your case it runs once because you placed a true statement as the Until condition. This is exactly opposite of the While statement, which will run until the condition is False. If the condition being checked starts as false, the While loop will not run at all. The help file clearly explains this as it states: The statements in between Do...Until are executed until the expression is true. There's no need for further explanation. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
undefinedspace Posted June 15, 2014 Author Share Posted June 15, 2014 (edited) Edit: delete. BrewManNH was right. excuse me. Edited June 15, 2014 by undefinedspace Link to comment Share on other sites More sharing options...
BrewManNH Posted June 15, 2014 Share Posted June 15, 2014 You're not making sense, you just agreed with me? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
undefinedspace Posted June 15, 2014 Author Share Posted June 15, 2014 The entry for PixelSearch still needs to be updated. Either it has some gimmicks not noted in helpfile or it just does not work. Manadar 's pixelget gets 350 pixel a second. Now to figure out _rgb. Link to comment Share on other sites More sharing options...
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