By
ags911
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;