thepopol777 Posted April 30, 2024 Posted April 30, 2024 ( Argh I lost my very old account here, can't remember what my username was, have to start from fresh π ) Hi guys, I have a hard time figuring out what's the catch with my PixelGetColor attempt. I know that there is a workaround for scaled screens, and having a 3840x2160 with 200% scale, I used to put a *2 on each coordinates that AI Window Info was returning. So far so good. But today, I can't achieve to get the right spot I need. You can take a look to the attached snapshot. The blue rectangle is the AI Window Info zone, the red spot is what I need to get ( dark blue color = 094171 ). While using AI Window Info, if I put the target on the spot, it returns 562 x 449, but the magnify zone shows white ( normal ). If I try to find the spot with the magnified zone, I find it around the green cross, at 1123 x 699 ( which is *2 , as usual ). But when I run my script, it returns me the color 606577 I tried to set my screen to 100% scale, and in this configuration the spot is at 1521 x 801. Tried to pick this spot to confirm it, while staying at 100%, and again it returns 606577 π΅ Do you guys have any idea of what I'm missing here ? Thank you ! $posX = 562 $posY = 349 $color = PixelGetColor($posX *2, $posY *2) MsgBox(0,"Test", "Color= "&$color) PS: I'm using this way to get which checkboxes are checked or not.
Nine Posted April 30, 2024 Posted April 30, 2024 (edited) Use au3info tool (mouse tab) to find/confirm position and pixel color ps : make sure Opt (mouse/pixel coord) are in line with au3info Edited April 30, 2024 by Nine thepopol777 1 βThey did not know it was impossible, so they did itβ β Mark Twain Reveal hidden contents 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
thepopol777 Posted April 30, 2024 Author Posted April 30, 2024 Thanks Nine, I think au3info is the same tool I was talking about by calling it AI Window Info. I also tried to force the coordMode but I got the same result π€ AutoItSetOption("PixelCoordMode",1)
thepopol777 Posted April 30, 2024 Author Posted April 30, 2024 And in the tool, coord mode is set to Screen, so should be ok
Nine Posted April 30, 2024 Posted April 30, 2024 I don't know, I use the tool all the time and it is always working as expected. Maybe you are better off the pixel approach, and try to identify the controls (look at UIAutomation if au3info tool cannot find them) βThey did not know it was impossible, so they did itβ β Mark Twain Reveal hidden contents 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 April 30, 2024 Posted April 30, 2024 put this at the top of the script, maybe it will help you #include <WinAPISys.au3> ;*** ConsoleWrite(_WinAPI_GetSystemMetrics(78) & " x " & _WinAPI_GetSystemMetrics(79) & @CRLF) ;*** If @AutoItX64 Then Exit MsgBox(262144 + 64, StringTrimRight(@ScriptName, 4), "Please run as 32bit", 60) DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", "int", -4) ; -4=PerMonitorAwareV2 ConsoleWrite(_WinAPI_GetSystemMetrics(78) & " x " & _WinAPI_GetSystemMetrics(79) & @CRLF) ;*** The ;Ξ*** are not needed, they are just for information thepopol777 1 I know that I know nothing
ioa747 Posted April 30, 2024 Posted April 30, 2024 take a look at that too thepopol777 1 I know that I know nothing
thepopol777 Posted April 30, 2024 Author Posted April 30, 2024 On 4/30/2024 at 12:34 PM, ioa747 said: put this at the top of the script, maybe it will help you #include <WinAPISys.au3> ;*** ConsoleWrite(_WinAPI_GetSystemMetrics(78) & " x " & _WinAPI_GetSystemMetrics(79) & @CRLF) ;*** If @AutoItX64 Then Exit MsgBox(262144 + 64, StringTrimRight(@ScriptName, 4), "Please run as 32bit", 60) DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", "int", -4) ; -4=PerMonitorAwareV2 ConsoleWrite(_WinAPI_GetSystemMetrics(78) & " x " & _WinAPI_GetSystemMetrics(79) & @CRLF) ;*** The ;Ξ*** are not needed, they are just for information Expand Hey ioa, thank you. I tried but it returns the same 606577 wrong color ( and console prints 1920 x 1080, 3840 x 2160 ). I tried to run this to find something, positioning the mouse at the exact same spot than the red arrow on my first screenshot: $pos = MouseGetPos() $col = PixelGetColor($pos[0]* 2, $pos[1]* 2) MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1] & "," & Hex($col)) And this returns '570, 350, 00094171' ( same coords I'm manually giving in the other script, returns good color ), it's driving me crazy π€ͺ @Nine Same! using this for years now and I never had any problem like that
thepopol777 Posted April 30, 2024 Author Posted April 30, 2024 On 4/30/2024 at 12:50 PM, ioa747 said: take a look at that too Expand Thanks for this tool, looks great. Returns me 1123 x 699 at the right spot ( same values after my usual *2 ), and good color info π€
Solution thepopol777 Posted April 30, 2024 Author Solution Posted April 30, 2024 FOUND IT ! It was not a coord issue, I forget to add Hex($color) π Found it by re-reading my 2nd script.... Sorry for the non-epic ending ioa747 1
thepopol777 Posted April 30, 2024 Author Posted April 30, 2024 By the way, do you think this is a good way to check is the checkboxes are 1 / 0 or is there a cleaver way to get this info ?
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