Jump to content

mouseclick location changes with screen resolution


Recommended Posts

Are there some good tips about how to keep the mouseclick in the same place when the screen resolution changes? I write a program for my pc, but the mouseclicks are off when I run the program on my laptop. For example, automating the google preferences, where I say I want 100 items to display, and then I save the preferences.

Here's my code snippet, where I click on the "save" button, and then click on the modal dialog box to dismiss it.

oautoit.mousemove 918,839 'save

oautoit.mouseclick "left"

oautoit.mousemove 937,585 'modal

oautoit.mouseclick "left"

Works perfect on my pc, but is way off when I run the program on my laptop.

Link to comment
Share on other sites

Best way to make your script independant of screen resolution is to use Controls when working with a GUI or the UDFs for IE, Firefox etc. when working with browsers.

MouseMove and MouseClick is far from being reliable.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Yes, thank you. So I should be using User Defined Functions (UDF's) for IE. Yes, I would love you, because definitely MouseMove and MouseClick make my code completely not transportable. Would it be extremely difficult for you to write code that navigates to http://www.google.com/preferences and then clicks on the "Save" button, so I could get a jump start?

Thank you.

Link to comment
Share on other sites

#include <ie.au3>
_IECreate("[url="http://www.google.com/preferences"]http://www.google.com/preferences[/url]")
should open the site.

Use _IEFormElementSetValue to enter your values into a form. And _IEAction with function "click" to click on the save button.

This is completely untested but should give you an idea where to start.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...