Libraryless. Click here for Pure Java version (4622L/31K/105K).
1 | !752 |
2 | |
3 | p { |
4 | new ShootLoop { |
5 | void recognize { |
6 | selections.clear(); |
7 | |
8 | // check for full screen window |
9 | //print(topRightCornerSimilarity("#1005918")); |
10 | |
11 | if (topRightCornerIs("#1005921") || topRightCornerIs("#1005918")) |
12 | selections.add(new Rect(maxWindowBounds())); |
13 | |
14 | // check for regular windows |
15 | L<Rect> topRight = concatLists( |
16 | findImageAll("#1005911"), findImageAll("#1005912")); |
17 | for (Rect right : topRight) { |
18 | int y1 = right.y; |
19 | L<Rect> left = concatLists( |
20 | findImageAllOnRow("#1005909", y1), |
21 | findImageAllOnRow("#1005910", y1)); |
22 | if (l(left) != 1) { |
23 | print(" Confused! No left corner for " + right); |
24 | continue; |
25 | } |
26 | Rect lft = first(left); |
27 | int x1 = lft.x-4; |
28 | //print(" Window title found, probably"); |
29 | int y2 = right.y2(); // title only |
30 | |
31 | L<Rect> bottom = concatLists( |
32 | findImageAllOnColumn("#1005913", x1), |
33 | findImageAllOnColumn("#1005914", x1)); |
34 | |
35 | if (l(bottom) == 1) |
36 | y2 = first(bottom).y2(); |
37 | else |
38 | print("Confused - no bottom left corner for " + lft); |
39 | |
40 | selections.add(pointsRect(x1, y1, right.x2(), y2)); |
41 | } |
42 | } |
43 | |
44 | void printState(long time) { |
45 | done_always(time, n(l(selections), "Opera windows") + " found"); |
46 | int nWindows = l(selections); |
47 | setConsoleIcon( |
48 | nWindows == 0 ? "#1005834" : |
49 | nWindows == 1 ? "#1005888" : |
50 | nWindows == 2 ? "#1005889" : |
51 | "#1005890"); |
52 | showThumbnail(); |
53 | } |
54 | }.run(); |
55 | } |
Began life as a copy of #1005906
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005915 |
Snippet name: | Find Opera window, show in thumbnail of screen [WORKS] |
Eternal ID of this version: | #1005915/1 |
Text MD5: | 9adef1c5c13b9f9ac2c99a11e670255a |
Transpilation MD5: | 1c8f6a94d89ade85bea2498d8f170aa1 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-12 20:27:18 |
Source code size: | 1681 bytes / 55 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 520 / 665 |
Referenced in: | [show references] |