Panamax Posted October 20 Posted October 20 Hi Guys, I am using the PixelGetColor function to find a particular color on the screen. For $height = 0 to @DesktopHeight For $width = 0 to @DeskTopWidth $pixel_value = PixelGetColor($width,$height) $pixel_value = Hex($pixel_value,8) If $pixel_value = "003AF2FF" Then MsgBox(0,"","Found at " & width & " x " & $height) Next Next It's just a little test script as I am still learning. However, I find that the script can take several minutes to complete particularly in a higher resoltion. Q: Is there a quicker function available, or am I stuck with PixelGetColor? Many thanks Pete
WildByDesign Posted October 20 Posted October 20 1 minute ago, Panamax said: Q: Is there a quicker function available, or am I stuck with PixelGetColor? Personally, I would try _WinAPI_GetPixel because I find that all of the WinAPI functions from UDF are generally quite a bit faster in comparison to the built-in AutoIt functions. I use a script that tests the performance between UDF functions and built-in AutoIt functions to compare the time diff when running thousands of times to grab the average time difference. I would suggest doing something like that as well. Compare the perf between the two functions.
WildByDesign Posted October 20 Posted October 20 17 minutes ago, Panamax said: If $pixel_value = "003AF2FF" Then MsgBox(0,"","Found at " & width & " x " & $height) You might also get hammered with MsgBox's slowing down your loop if you happen to have many pixels of that same value on your screen. Unless it's some situation where you know for certain that there are no other pixels of that same matching color.
argumentum Posted October 20 Posted October 20 You could have more instances looking for it and report via IPC ( my take on "how" here ) and there are a few in the WiKi that you can try. This way if you run 8 chunks of screen, it'll 8 times faster of whatever technique you use. WildByDesign and SOLVE-SMART 2 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Nine Posted October 20 Posted October 20 You could try my Screen Scraping UDF. When searching for multiple pixels in a single screen, my UDF will satisfy your expectations (I believe). “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
argumentum Posted October 20 Posted October 20 5 minutes ago, paw said: it's fast "One of the reasons FastFind is so much quicker than AutoIt's native pixel search functions is it's use of SnapShots. A SnapShot is basically a pixel map of a specified area on screen as it looked at the time the SnapShot was taken. This pixel information is stored in active memory, which means your script can access it much, much faster than the time it would take to make a new pixel request from the screen. Once a SnapShot is taken, search operations can be performed on that SnapShot until that memory is freed or overwritten." Yes, you could take a screenshot and search the BMP. I forgot what thread it was at but working code ( other than this DLL ) can be found in the forum ( if you find it ). @paw, thanks for the link. I never use pixel... anything but it looks good Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Nine Posted October 20 Posted October 20 Maybe but the guy hasn't showed up for 13 years. OP should consider this in is final choice... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
ioa747 Posted October 21 Posted October 21 (edited) Edit: Local $aCoord = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0xA44200) If Not @error Then ConsoleWrite("Found at " & $aCoord[0] & "," & $aCoord[1] & @CRLF) EndIf Edited October 23 by ioa747 Redefined I know that I know nothing
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