Maxzor Posted February 24, 2017 Share Posted February 24, 2017 Hello, I am trying to automate a job on an app that I think tries to prevent it : my app refuses to make some action with Controlclick, however with MouseClick it is fine. So I am trying to get absolute pos of my control, followed code from this thread : My problem is that AutoIt Window info gives me this : --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- >>>> Window <<<< Title: xx Class: WinDevObject Position: -9, -9 Size: 1698, 1018 Style: 0x17CF0000 ExStyle: 0x00000300 Handle: 0x00000000000902F4 >>>> Control <<<< Class: Button Instance: 129 ClassnameNN: Button129 Name: Advanced (Class): [CLASS:Button; INSTANCE:129] ID: Text: Position: 1268, 54 Size: 32, 40 ControlClick Coords: 0, 0 Style: 0x50000000 ExStyle: 0x00000000 Handle: 0x0000000000071098 >>>> Mouse <<<< Position: 1270, 85 Cursor ID: 0 Color: 0x9F4517 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Mouse is here at exact upper-left-hand corner of button129, but there is a significant discrepancy between control pos and mous pos. When on value returned by ControlPos method, mouse is actually not hovering anymore onto control. How is this happening? Best regards ( I admit I did not browse forum carefully, please bear with my noobing...) Link to comment Share on other sites More sharing options...
InnI Posted February 25, 2017 Share Posted February 25, 2017 You can use relative coords to the client area. For example MouseClick to center of button Opt("MouseCoordMode", 2) WinActivate("[Class:WinDevObject]") $aPos = ControlGetPos("[Class:WinDevObject]", "", "Button129") If IsArray($aPos) Then $iX = $aPos[0] + $aPos[2] / 2 $iY = $aPos[1] + $aPos[3] / 2 MouseClick("", $iX, $iY) EndIf Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 25, 2017 Moderators Share Posted February 25, 2017 Maxzor, I imagine it is the DPI setting - as explained here. 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...
Maxzor Posted February 27, 2017 Author Share Posted February 27, 2017 Thank you for your inputs, I checked and my problem is not related to DPI settings, I believe it is more of a "window docking" issue. My windows when max expanded are all placed at -8,-8, and sub-tiles compounds only make things worse adding discrepancies. Link to comment Share on other sites More sharing options...
Maxzor Posted February 28, 2017 Author Share Posted February 28, 2017 What I meant is that wether im with 100, 125 or 150% dpi, the problem is here : the controls are mostly not where they say they are 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