Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

41
LINES

< > BotCompany Repo | #1005891 // Find blue Java windows (Substance), show in thumbnail of screen

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (4565L/31K/104K).

1  
!752
2  
3  
static int nWindows;
4  
5  
p {
6  
  new ShootLoop {
7  
    void recognize {
8  
      L<Rect> topRight = findImageAll("#1005882");
9  
      nWindows = l(topRight);
10  
      selections.clear();
11  
      for (Rect right : topRight) {
12  
        int y1 = right.y;
13  
        L<Rect> left = findImageAllOnRow("#1005896", y1);
14  
        if (l(left) != 1) {
15  
          print("  Confused!");
16  
          continue;
17  
        }
18  
        int x1 = first(left).x;
19  
        //print("  Window title found, probably");
20  
        int y2 = y1+right.y; // title only
21  
        
22  
        L<Rect> bottom = findImageAllOnColumn("#1005899", x1);
23  
        
24  
        if (l(bottom) == 1)
25  
          y2 = first(bottom).y2();
26  
          
27  
        selections.add(pointsRect(x1, y1, right.x2(), y2));
28  
      }
29  
    }
30  
    
31  
    void printState(long time) {
32  
      done_always(time, n(nWindows, "Java windows") + " found");
33  
      setConsoleIcon(
34  
        nWindows == 0 ? "#1005834" :
35  
        nWindows == 1 ? "#1005888" :
36  
        nWindows == 2 ? "#1005889" :
37  
          "#1005890");
38  
      showThumbnail();
39  
    }
40  
  }.run();
41  
}

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: #1005891
Snippet name: Find blue Java windows (Substance), show in thumbnail of screen
Eternal ID of this version: #1005891/1
Text MD5: e698c7e9c7b5f1be7530af0fde4dc558
Transpilation MD5: 0463e042308b37656d5b9df30d931b25
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 15:14:50
Source code size: 1083 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 468 / 635
Referenced in: [show references]