Jump to content

Recommended Posts

Posted

I have a script that has to work on multiple resolutions but each resolution has slightly different co-ordinates due to automatic UI scaling. I have had to make separate files for each but would like to implement them all in one script. I have a similar program written for Java which uses else if statements to use different co-ordinates for each resolution after it has been detected. I'm not good with Java so I would like to implement this on AutoIt before later making a Java version.

 

This is a snippet of the autoit code I have.

ToolTip("1 - Search")
MouseClick("Left", @DesktopWidth *0.823, @DesktopHeight *0.925, 1, 25)

ToolTip("2 - Buy Now")
MouseClick("Left", @DesktopWidth *0.83, @DesktopHeight *0.798, 1, 27)

ToolTip("3 - OK")
MouseClick("Left", @DesktopWidth *0.555, @DesktopHeight *0.596, 1, 15)

ToolTip("4 - OK Clear Error")
MouseClick("Left", @DesktopWidth *0.49, @DesktopHeight *0.597, 1, 30)

ToolTip("5 - Back to Search")
MouseClick("Left", @DesktopWidth *0.161, @DesktopHeight *0.108, 1, 15)

 

This is a snippet of a java code I used.

Thanks.

private static void goToSearch(double maxX, double maxY, Robot bot) throws InterruptedException {

    int currentX = 0;

    int currentY = 0;

    if (maxX == 2650 && maxY == 1440) {

        currentX = 734;

        currentY = 1316;

    } else if (maxX == 1920 && maxY == 1200) {

        currentX = 551;

        currentY = 1096;

    } else if (maxX == 1920 && maxY == 1080) {

        currentX = 551;

        currentY = 1042;

    } else if (maxX == 1680 && maxY == 1050) {

        currentX = 482;

        currentY = 959;

    } else if (maxX == 1440 && maxY == 900) {

        currentX = 413;

        currentY = 822;

    } else if (maxX == 1366 && maxY == 768) {

        currentX = 392;

        currentY = 741;

    } else if (maxX == 1280 && maxY == 800) {

        currentX = 367;

        currentY = 731;
  • Moderators
Posted

@ags911 can you please explain what your end goal is with the AutoIt script? There is almost certainly a much better way of accomplishing what you're after than with unreliable MouseClicks based on screen resolution (as you are finding out).

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted

Thanks for the reply. Please find the file attached. The mouse interacts with different elements onscreen of an online game via google chrome. Do you have anything in mind? The elements change and scale slightly for each resolution so I've had to compile a different script for each. The idea was that I could put everything into one simple script that detects the monitor resolution and automatically uses the script for that resolution.

PAB Forum - 1920 x 1080 - Speed (Slow).au3

  • Moderators
Posted

Unfortunately, you seem to have missed the forum rules during your time here. Please read them now, especially the part on game automation, and you will see why this thread is now locked.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Guest
This topic is now closed to further replies.
×
×
  • Create New...