Bonjour,
merci de m'avoir repondu.
J'ai essaye d'implante ce que vous m'avez proposé, ca me pose un soucis a ce niveau :
robot.mouseMove(point.x + correctionX[monindicequisincrementejesaispascomment], point.y + correctionY[monindicequisincrementejesaispascomment]);
j'ai le message d'erreur suivant : array type expected; found: 'int' java
J'ai vue que ce matin je n'es pas précise que j'ai 4 choix de correctionx possible via un SWITCH.
voici comment je choisi le mode
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
................
Config currentConfig1 = ConfigManager1.getInstance1().getCurrentConfig();
executorService.submit(() -> {
try {
Robot robot = new Robot();
Point point;
int correctionX = 0;
int correctionY = 0;
int rateoff = 0;
int ntime = 0;
while (Main.enable && Main.leftclick) {
switch (Main.choix) {
case CHOIX1:
if (Main.rightClick) {
correctionY = currentConfig1.x1;
rateoff = currentConfig1.rateoff;
ntime = currentConfig1.ntime;
} else {
correctionY = currentConfig1.defaultcorrectionY;
rateoff = currentConfig1.defaultrateoff;
}
break;
case CHOIX2:
if (Main.rightClick) {
correctionY = currentConfig1.x2;
rateoff = currentConfig1.rateoff;
ntime = currentConfig1.ntime;
} else {
correctionY = currentConfig1.defaultcorrectionY;
rateoff = currentConfig1.defaultrateoff;
}
break;
case CHOIX3:
if (Main.rightClick) {
correctionY = currentConfig1.x3;
rateoff = currentConfig1.rateoff;
ntime = currentConfig1.ntime;
} else {
correctionY = currentConfig1.defaultcorrectionY;
rateoff = currentConfig1.defaultrateoff;
}
break;
case CHOIX4:
if (Main.rightClick) {
correctionY = currentConfig1.x4;
rateoff = currentConfig1.rateoff;
ntime = currentConfig1.ntime;
} else {
correctionY = currentConfig1.defaultcorrectionY;
rateoff = currentConfig1.defaultrateoff;
}
}
Thread.sleep(1);
point = MouseInfo.getPointerInfo().getLocation();
robot.mouseMove(point.x + correctionX, point.y + correctionY);
Thread.sleep(rateoffire,ntime);
}
} catch (Exception e1) {
e1.printStackTrace();
}
});
........ |
mon fichier config qui fait la liaison avec le json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| public class Config { // Ne jamais modifie cette class
String name = "Default";
int defaultcorrectionY = 0;
int defaultrateoff = 10;
int rateoff = 0;
int ntime = 0;
int x1 = 0;
int x2 = 0;
int x3 = 0;
int x4 = 0;
} |
et pour finir un de mes fichiers json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| {
"name": "TEST",
"rateoff": 10, "ntime": 0, //temps milliseconde et nanoseconde
"x1": 10, ----> ici je souhaiterai pouvoir avoir ceci : {10,12,15,8,4,18} Par exemple
"x2": 15,
"x3": 20,
"x4": 30
} |
Cordialement
Fred
Partager