RCLens Posted August 21, 2017 Share Posted August 21, 2017 (edited) Hello, I'd like for any screen or window size, the coordinates using MouseClick or ControlClick are always the same. How fix that? Thank you Edited August 21, 2017 by RCLens Link to comment Share on other sites More sharing options...
water Posted August 21, 2017 Share Posted August 21, 2017 Usually you do not need the coordinates when using Control* functions. That's the recommended and reliable way to automate applications. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
RCLens Posted August 21, 2017 Author Share Posted August 21, 2017 11 minutes ago, water said: Usually you do not need the coordinates when using Control* functions. That's the recommended and reliable way to automate applications. The problem is, in the software I'm using Windows Info doesn't show all the Instance/Name etc.. for each buttonm it's like a picture I mean. Link to comment Share on other sites More sharing options...
water Posted August 21, 2017 Share Posted August 21, 2017 Which application do you try to automate? Can you please post a screenshot of the AutoIt Window Info Tool? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
RCLens Posted August 21, 2017 Author Share Posted August 21, 2017 (edited) I try to automate an ERP. Edited August 21, 2017 by RCLens Link to comment Share on other sites More sharing options...
water Posted August 21, 2017 Share Posted August 21, 2017 You could use AutoItSetOption("MouseCoordMode", n) ; n: 0 = relative coords to the active window, 2 = relative coords to the client area of the active window RCLens 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
RCLens Posted August 21, 2017 Author Share Posted August 21, 2017 33 minutes ago, water said: You could use AutoItSetOption("MouseCoordMode", n) ; n: 0 = relative coords to the active window, 2 = relative coords to the client area of the active window So in this case, if n = 0, the size doesn't matter ? In this case I should use n = 0, shouldn't I? Plus, use ControlClick() doesn't seem to be really 'professionnel', is it normal in such case? Link to comment Share on other sites More sharing options...
water Posted August 21, 2017 Share Posted August 21, 2017 (edited) 0 or 2 should work for you. Then it doesn't matter where on the screen the window is located. The client area is the inside area of a window excluding the title bar, toolbars, status bar, scroll bars. Not every control can be automated using Control* functions. According to the help file: "Note: AutoIt only works with standard Microsoft controls. Some applications write their own custom controls which may look like a standard MS control but may resist automation." IIRC Windows.Forms is one of them. I have never used such controls, so I might be wrong. Best to either search the forum for Windows Forms or try it yourself. A solution is "professional" when it fits your needs. Means: It works, is fast and you understand your code even when a few months have passed Edited August 21, 2017 by water RCLens 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
RCLens Posted August 21, 2017 Author Share Posted August 21, 2017 Thank you so much for all your details!! Link to comment Share on other sites More sharing options...
water Posted August 21, 2017 Share Posted August 21, 2017 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki 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