Vitaliy4us Posted July 9, 2019 Share Posted July 9, 2019 I use _ScreenCapture_Capture function for taking a screenshot with cursor located within browser window. But cursor position on the screenshot is misaligned. Its location is shifted about 20px left and 20px up. What is the reason of this issue? Link to comment Share on other sites More sharing options...
Nine Posted July 9, 2019 Share Posted July 9, 2019 What is your scaling ? If it is different than 100%. Try setting browser and windows at 100%, see if it solves it. “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...
TheXman Posted July 9, 2019 Share Posted July 9, 2019 (edited) How did you determine what the coordinates for the _ScreenCapture_Capture() should be? If you used the Au3Info tool, which coordinate mode did you use? If you are using MouseGetPos(), then make sure that you are using the correct MouseCoodMode option. Edited July 9, 2019 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Vitaliy4us Posted July 10, 2019 Author Share Posted July 10, 2019 15 hours ago, Nine said: What is your scaling ? If it is different than 100%. Try setting browser and windows at 100%, see if it solves it. Checked once more for the paint window. The result is the same as for the browser Link to comment Share on other sites More sharing options...
Developers Jos Posted July 10, 2019 Developers Share Posted July 10, 2019 1 hour ago, Vitaliy4us said: Checked once more for the paint window. The result is the same as for the browser ... and the answers to the asked questions are? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Vitaliy4us Posted July 11, 2019 Author Share Posted July 11, 2019 On 7/10/2019 at 12:36 PM, Jos said: ... and the answers to the asked questions are? Jos 100% - the result is the same. Link to comment Share on other sites More sharing options...
Bert Posted July 11, 2019 Share Posted July 11, 2019 Post your code so we can see what is happening. I suspect your coordinate mode setting is wrong. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Vitaliy4us Posted July 15, 2019 Author Share Posted July 15, 2019 On 7/11/2019 at 10:02 PM, Bert said: Post your code so we can see what is happening. I suspect your coordinate mode setting is wrong. #include <ScreenCapture.au3> HotKeySet("+s", "TakeAScreenshot") ;Shift+s HotKeySet("{ESC}", "Terminate") While 1 Sleep(100) WEnd Func Terminate() Exit EndFunc Func TakeAScreenshot() _ScreenCapture_Capture ("Screenshot with cursor.jpg") ;Exit EndFunc Link to comment Share on other sites More sharing options...
Nine Posted July 15, 2019 Share Posted July 15, 2019 (edited) Using your own code with your own picture, you can see that it works perfectly... I still believe it is a question of scaling. Edited March 31, 2023 by Nine “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...
Vitaliy4us Posted July 17, 2019 Author Share Posted July 17, 2019 On 7/15/2019 at 5:06 PM, Nine said: Using your own code with your own picture, you can see that it works perfectly... I still believe it is a question of scaling. Yes, I agree with you. But the question is why this scaling happens. If I make two screenshots: one with the PrnScn button and another with the script I get different results. Those made with the button is not scaled and script made screenshot is really scaled... Link to comment Share on other sites More sharing options...
Nine Posted July 17, 2019 Share Posted July 17, 2019 (edited) This is the code included in the ScreenCapture.au3 UDF about location of cursor : Local $aCursor = _WinAPI_GetCursorInfo() If Not @error And $aCursor[1] Then $bCursor = True ; Cursor info was found. Local $hIcon = _WinAPI_CopyIcon($aCursor[2]) Local $aIcon = _WinAPI_GetIconInfo($hIcon) If Not @error Then _WinAPI_DeleteObject($aIcon[4]) ; delete bitmap mask return by _WinAPI_GetIconInfo() If $aIcon[5] <> 0 Then _WinAPI_DeleteObject($aIcon[5]); delete bitmap hbmColor return by _WinAPI_GetIconInfo() _WinAPI_DrawIcon($hCDC, $aCursor[3] - $aIcon[2] - $iLeft, $aCursor[4] - $aIcon[3] - $iTop, $hIcon) EndIf _WinAPI_DestroyIcon($hIcon) EndIf If you wish to find where the function is in error, you could modify to check where the info gets defective... Edited July 17, 2019 by Nine “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...
Vitaliy4us Posted July 17, 2019 Author Share Posted July 17, 2019 31 minutes ago, Nine said: This is the code included in the ScreenCapture.au3 UDF about location of cursor : Local $aCursor = _WinAPI_GetCursorInfo() If Not @error And $aCursor[1] Then $bCursor = True ; Cursor info was found. Local $hIcon = _WinAPI_CopyIcon($aCursor[2]) Local $aIcon = _WinAPI_GetIconInfo($hIcon) If Not @error Then _WinAPI_DeleteObject($aIcon[4]) ; delete bitmap mask return by _WinAPI_GetIconInfo() If $aIcon[5] <> 0 Then _WinAPI_DeleteObject($aIcon[5]); delete bitmap hbmColor return by _WinAPI_GetIconInfo() _WinAPI_DrawIcon($hCDC, $aCursor[3] - $aIcon[2] - $iLeft, $aCursor[4] - $aIcon[3] - $iTop, $hIcon) EndIf _WinAPI_DestroyIcon($hIcon) EndIf If you wish to find where the function is in error, you could modify to check where the info gets defective... No errors, cursor coordinates remain the same from the beginning until calling draw icon function. So cursor is captured ok, but the screen image underneath the cursor shrinks. Link to comment Share on other sites More sharing options...
Nine Posted July 17, 2019 Share Posted July 17, 2019 7 minutes ago, Vitaliy4us said: So cursor is captured ok, but the screen image underneath the cursor shrinks. If the image shrinks, should the cursor be located down-right ? In you case, it is up-left, like if the image expands, no ? What version of windows and autoit are you using ? “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...
Vitaliy4us Posted July 17, 2019 Author Share Posted July 17, 2019 (edited) 14 minutes ago, Nine said: If the image shrinks, should the cursor be located down-right ? In you case, it is up-left, like if the image expands, no ? What version of windows and autoit are you using ? I use Win10 and the last version of Autoit v. 3.3.14 Edited July 17, 2019 by Vitaliy4us Link to comment Share on other sites More sharing options...
Nine Posted July 17, 2019 Share Posted July 17, 2019 Just curious, could you look at this : Go to the Windows Start Menu. Choose Settings. Select System. Select Display. Look for Scale and layout. What is the % ? “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...
Vitaliy4us Posted July 17, 2019 Author Share Posted July 17, 2019 16 minutes ago, Nine said: Just curious, could you look at this : Go to the Windows Start Menu. Choose Settings. Select System. Select Display. Look for Scale and layout. What is the % ? 125% (recommended). Also I checked image sizes for the both: PrnScn screenshot and Script Screenshot. The results are: btn - 1920x1080 resolution 120 script - 1536x864 resolution 96 Link to comment Share on other sites More sharing options...
Nine Posted July 17, 2019 Share Posted July 17, 2019 Could you put 100% instead and try your script again... “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...
Vitaliy4us Posted July 17, 2019 Author Share Posted July 17, 2019 (edited) 9 minutes ago, Nine said: Could you put 100% instead and try your script again... Yes, now it looks ok, but too small. Thanks. By the way, it should be the reason why the screenshot made by the script is cropped while captured with the button is ok. Edited July 17, 2019 by Vitaliy4us Link to comment Share on other sites More sharing options...
Nine Posted July 17, 2019 Share Posted July 17, 2019 Figured, got the same problem, so I decided to go with 1440 x 900 resolution and 100% scaling, now everything works perfectly Skysnake and Vitaliy4us 1 1 “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...
InnI Posted July 18, 2019 Share Posted July 18, 2019 Try to add this string to begin of the script DllCall("User32.dll", "bool", "SetProcessDPIAware") 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