Hospital Posted September 14, 2015 Share Posted September 14, 2015 can someone help me here?have been trying to figure out how to list all the different colors in a certain region to an array?how would I do this? thanks Link to comment Share on other sites More sharing options...
Radiance Posted September 14, 2015 Share Posted September 14, 2015 (edited) Something like this: #include <Array.au3> Global $TopLeftX = 0 Global $TopLeftY = 0 Global $BotRightX = 10 Global $BotRightY = 10 Global $Array[1] = [0] For $i = $TopLeftX To $BotRightX For $j = $TopLeftY To $BotRightY $Array[0] += 1 ReDim $Array[$Array[0] + 1] $Array[$Array[0]] = "Color on coordinate X:" & $i & "/Y:" & $j & " - " & PixelGetColor($i, $j) Next Next _ArrayDisplay($Array)What you need is basically two points on your screen, one on the top left and one of the bottom right that would mark a rectangle.Just replace the values in the first four variables. Edited September 14, 2015 by Radiance Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 14, 2015 Moderators Share Posted September 14, 2015 Radiance,ReDim is one of the slowest functions in AutoIt, especially when it comes to large arrays, so calling it within a loop as you do is really slowing the script. As you know the size of the area to be stored why not size the array correctly beforehand - or even better use a 2D array so that the array indices reflect the coordinates of the point stored within?M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Radiance Posted September 14, 2015 Share Posted September 14, 2015 Melba23,I did not know that. Here's my updated script.Pretty slow when the rectangle gets bigger but that might be the PixelGetColor func.#include <Array.au3> Global $TopLeftX = 0 Global $TopLeftY = 0 Global $BotRightX = 10 Global $BotRightY = 10 Global $Array[$BotRightX - $TopLeftX + 1][$BotRightY - $TopLeftY + 1] For $i = 0 To UBound($Array) - 1 For $j = 0 To UBound($Array, 2) - 1 $Array[$i][$j] = PixelGetColor($TopLeftX + $i, $TopLeftY + $j) Next Next _ArrayDisplay($Array) Link to comment Share on other sites More sharing options...
Hospital Posted September 20, 2015 Author Share Posted September 20, 2015 (edited) Melba23,I did not know that. Here's my updated script.Pretty slow when the rectangle gets bigger but that might be the PixelGetColor func.#include <Array.au3> Global $TopLeftX = 0 Global $TopLeftY = 0 Global $BotRightX = 10 Global $BotRightY = 10 Global $Array[$BotRightX - $TopLeftX + 1][$BotRightY - $TopLeftY + 1] For $i = 0 To UBound($Array) - 1 For $j = 0 To UBound($Array, 2) - 1 $Array[$i][$j] = PixelGetColor($TopLeftX + $i, $TopLeftY + $j) Next Next _ArrayDisplay($Array)What would be the fastest way to not list the same pixel, without writing each one down to notepad and scanning down the document to see if it's already there?Thank you guys appreciate it./edit, i got it.now i'm working on the gui with artifical pixels Edited September 20, 2015 by Hospital 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