!752 static int nWindows; p { new ShootLoop { void recognize { L topRight = findImageAll("#1005882"); nWindows = l(topRight); selections.clear(); for (Rect right : topRight) { int y1 = right.y; L left = findImageAllOnRow("#1005896", y1); if (l(left) != 1) { print(" Confused!"); continue; } int x1 = first(left).x; //print(" Window title found, probably"); int y2 = y1+right.y; // title only L bottom = findImageAllOnColumn("#1005899", x1); if (l(bottom) == 1) y2 = first(bottom).y2(); selections.add(pointsRect(x1, y1, right.x2(), y2)); } } void printState(long time) { done_always(time, n(nWindows, "Java windows") + " found"); setConsoleIcon( nWindows == 0 ? "#1005834" : nWindows == 1 ? "#1005888" : nWindows == 2 ? "#1005889" : "#1005890"); showThumbnail(); } }.run(); }