private static int getInteger(Object aObj) { return getInteger(aObj, 0); }
private static double getNumber(Object aObj) { return getNumber(aObj, 0.0); } //</editor-fold>
/** * move the mouse to the given location with a given offset<br> * 3 parameter configurations:<br> * --1: wait for a visual and move mouse to it (args see wait())<br> * --2: move to the given region/location/match with a given offset<br> * --3: move to the given offset relative to the last match of the region in use * * @param args * @return the evaluated location to where the mouse should have moved */ public static Location hover(Object... args) { logCmd("hover", args); return hoverx(args); }
if (!isJSON(aObj)) { return aObj; aObj = new Screen(intFromJSON(json, 5)); ((Screen) aObj).setRect(rectFromJSON(json)); } else if ("R".equals(oType)) { newObj = new Region(rectFromJSON(json)); } else if ("M".equals(oType)) { double score = dblFromJSON(json, 5) / 100; newObj = new Match(new Region(rectFromJSON(json)), score); ((Match) newObj).setTarget(intFromJSON(json, 6), intFromJSON(json, 7)); } else if ("L".equals(oType)) { newObj = new Location(locFromJSON(json)); } else if ("P".equals(oType)) { newObj = new Pattern(json[1]); ((Pattern) newObj).similar(fltFromJSON(json, 2)); ((Pattern) newObj).targetOffset(intFromJSON(json, 3), intFromJSON(json, 4));
Object aObj = args[0]; Location loc = null; if (isJSON(aObj)) { aObj = fromJSON(aObj); aMatch = wait(args); Mouse.move(aMatch.getTarget()); } catch (Exception ex) { if (isNumber(aObj) && isNumber(args[1])) { Mouse.move(scr.checkMatch().offset(getInteger(aObj), getInteger(args[1]))); return Mouse.at(); } else if (len == 3 && loc != null && isNumber(args[1]) && isNumber(args[2])) { Mouse.move(loc.offset(getInteger(args[1], 0), getInteger(args[2], 0))); return Mouse.at();
return realArgs; if (isJSON(aObj)) { aObj = fromJSON(aObj); } else if (aObj instanceof Pattern) { realArgs[1] = aObj; if (len > 1 && isNumber(args[1])) { realArgs[2] = (Double) getNumber(args[1]); } else if (isNumber(aObj)) { scr.wait(getNumber(aObj)); return null; } else { if (len > 2 && isNumber(args[2])) { score = (float) getNumber(args[2]) / 100.0f; if (score < 0.7) { score = 0.7f; realArgs[3] = (Float) score; if (len > 1 && isNumber(args[1])) { realArgs[2] = (Double) getNumber(args[1]);
/** * move the mouse with hover() and double click using the left button * * @param args see hover() * @return the location, where the double click was done */ public static Location doubleClick(Object... args) { logCmd("doubleClick", args); Location loc = hoverx(args); Mouse.click(null, Button.LEFT, 0, true, null); return Mouse.at(); }
private static Region usex(Object... args) { int len = args.length; int nScreen = -1; if (len == 0 || len > 1) { scr = new Screen(); return scr; } nScreen = getInteger(args[0], -1); if (nScreen > -1) { scr = new Screen(nScreen); } else { Object oReg = args[0]; if (oReg instanceof Region) { scr = (Region) oReg; } } return scr; } //</editor-fold>
/** * move the mouse with hover() and do a right click * * @param args see hover() * @return the location, where the right click was done */ public static Location rightClick(Object... args) { logCmd("rightClick", args); Location loc = hoverx(args); Mouse.click(null, Button.RIGHT, 0, false, null); return Mouse.at(); } //</editor-fold>
/** * move the mouse with hover() and click using the left button * * @param args see hover() * @return the location, where the click was done */ public static Location click(Object... args) { logCmd("click", args); Location loc = hoverx(args); Mouse.click(null, Button.LEFT, 0, false, null); return Mouse.at(); }