aeun01 Posted October 22, 2022 Share Posted October 22, 2022 (edited) hello I'm making a macro that stores and finds a value for a pixel based on the mouse position. However, I want to load several values at once and compare them in two-dimensional units ex) Pixel size 30x20 I'm testing on a one-dimensional array. By the way, pixelgetcolor returns two x and y values as one value and is stored in an array, but vice versa. Since pixelsearch returns one value as two x and y values, if you put it in an array and print it out It only comes out as {array} , so I can't tell if I coded it correctly. How can I see that value as an x,y value? expandcollapse popup#RequireAdmin #include <MsgBoxConstants.au3> #include <Array.au3> HotKeySet("{F6}","exit1") Func exit1() Exit EndFunc Local $Color Global $Mouse_Position Global $array1[20] Global $array2[20] $Mouse_Position = MouseGetPos() $Color = PixelGetColor($Mouse_Position[0],$Mouse_Position[1]) MsgBox($MB_SYSTEMMODAL,"", " " & $Mouse_Position[0] & "," & $Mouse_Position[1] ) Local $i = 0 For $y = $Mouse_Position[1] To $Mouse_Position[1]+19 $Color = PixelGetColor($Mouse_Position[0],$y) $array1[$i] = $Color $i = $i + 1 Next _ArrayDisplay($array1, "arr1") Sleep(300) Global $xy[20] For $k = 0 To 10 $xy[$k] = PixelSearch(0, 0, 1920, 1080, $array1[$k], 0 ) MsgBox($MB_SYSTEMMODAL, "", "X, Y : " & $xy[$k]) _ArrayDisplay($xy, "xy") Next #cs If Not @error Then MouseMove($Mouse_Position2[0],$Mouse_Position2[1]) EndIf #ce Edited October 22, 2022 by Jos Please use standard fonts and post code in a codeblock <> Link to comment Share on other sites More sharing options...
Nine Posted October 22, 2022 Share Posted October 22, 2022 Your loop should look like this : Global $xy[20][2], $aTmp For $k = 0 To 19 $aTmp = PixelSearch(0, 0, 1920, 1080, $array1[$k]) ;MsgBox($MB_SYSTEMMODAL, "", "X, Y : " & $aTmp[0] & "/" & $aTmp[1]) $xy[$k][0] = $aTmp[0] $xy[$k][1] = $aTmp[1] Next _ArrayDisplay($xy, "xy") But remember, it may take a long time to complete if you are on Win10 +. You should consider using my Screen Scraping UDF (see my signature). “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) Screen Scraping Multi-Threading Made Easy 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