ayatest Posted March 20, 2015 Posted March 20, 2015 When using ControlGetPos to determine control location in app window - I'm getting coordinates, that start not from the external borders of an app, but from internal guts. Which means, that header (the thing with app name) and left border is excluded. This generates certain problem, because from what I can say - win8 and win7 have different container layouts. So my question. How to get control position in relation to complete gui of the app, or just absolute coordinates? functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.
jdelaney Posted March 20, 2015 Posted March 20, 2015 There are ways to get the exact 'absolute' coords with the _winapi functions. What are you actually attempting to do, though? If you want to click it, use ControlClick...coords don't matter then. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
ayatest Posted March 23, 2015 Author Posted March 23, 2015 It looks that after weekend forum update, my post disappeared. The problem is, that this internal window of the app has it's own screen handles, so there is no way to use ControlClick on them. The only way is to use regular screen clicking and dragging. If I run the script on different win7/8 machine/layout, then everything is shifted, and the mouse no longer hits the item area. Header and border sizes also change when using windowed/maximized mode. So I need to get the position of a subwindow in relation to (0,0) coordinates of the screen or of the outer borderline of win aplication. Having true location (and size) of that control - I can scale parameters to hit proper positions. I'm designing test scenarios, why the question? functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.
ayatest Posted March 24, 2015 Author Posted March 24, 2015 I have no idea how to achieve it. Some example would be helpful. functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.
Solution jguinch Posted March 24, 2015 Solution Posted March 24, 2015 You can use WinGetPos with a control handle, so you will have its position/dimensions relative to the screen : Run("notepad.exe") $hWnd = WinWait("[CLASS:Notepad]") $hEdit = ControlGetHandle($hWnd, "", "[CLASS:Edit; INSTANCE:1]") $aEditPos = WinGetPos($hEdit) ConsoleWrite("LEFT : " & $aEditPos[0] & @CRLF & _ "TOP : " & $aEditPos[1] & @CRLF & _ "WIDTH : " & $aEditPos[2] & @CRLF & _ "HEIGHT : " & $aEditPos[3] & @CRLF ) Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
ayatest Posted March 24, 2015 Author Posted March 24, 2015 Thanks, this should work. I just found on google and tested similar thing. functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general.
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