Jump to content
RCLens

[solved] How fix the size of the window for any screen and window size?

Recommended Posts

RCLens

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 by RCLens

Share this post


Link to post
Share on other sites
water

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
RCLens
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.

Share this post


Link to post
Share on other sites
water

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
RCLens

I try to automate an ERP.

 

 

 

Capture.PNG

Edited by RCLens

Share this post


Link to post
Share on other sites
water

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

 

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
RCLens
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?

Share this post


Link to post
Share on other sites
water

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 by water
  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
water

:)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.