!752 p { new ShootLoop { void recognize { selections.clear(); // check for full screen window //print(topRightCornerSimilarity("#1005918")); if (topRightCornerIs("#1005921") || topRightCornerIs("#1005918")) selections.add(new Rect(maxWindowBounds())); // check for regular windows L topRight = concatLists( findImageAll("#1005911"), findImageAll("#1005912")); for (Rect right : topRight) { int y1 = right.y; L left = concatLists( findImageAllOnRow("#1005909", y1), findImageAllOnRow("#1005910", y1)); if (l(left) != 1) { print(" Confused! No left corner for " + right); continue; } Rect lft = first(left); int x1 = lft.x-4; //print(" Window title found, probably"); int y2 = right.y2(); // title only L bottom = concatLists( findImageAllOnColumn("#1005913", x1), findImageAllOnColumn("#1005914", x1)); if (l(bottom) == 1) y2 = first(bottom).y2(); else print("Confused - no bottom left corner for " + lft); selections.add(pointsRect(x1, y1, right.x2(), y2)); } } void printState(long time) { done_always(time, n(l(selections), "Opera windows") + " found"); int nWindows = l(selections); setConsoleIcon( nWindows == 0 ? "#1005834" : nWindows == 1 ? "#1005888" : nWindows == 2 ? "#1005889" : "#1005890"); showThumbnail(); } }.run(); }