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).

!752

static int nWindows;

p {
  new ShootLoop {
    void recognize {
      L<Rect> topRight = findImageAll("#1005882");
      nWindows = l(topRight);
      selections.clear();
      for (Rect right : topRight) {
        int y1 = right.y;
        L<Rect> 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<Rect> 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();
}

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: 400 / 548
Referenced in: [show references]