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

35
LINES

< > BotCompany Repo | #1005831 // Recognize Slack [v1, WORKS]

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

Libraryless. Click here for Pure Java version (2833L/19K/63K).

1  
!752
2  
3  
static bool onSlack;
4  
static BWImage screen;
5  
6  
p {
7  
  while licensed {
8  
    sleepSeconds(1);
9  
    long time = now();
10  
    shoot();
11  
    recognize();
12  
    printState(time);
13  
  }
14  
}
15  
16  
svoid recognize {
17  
  // Two versions for different browsers (Opera/Firefox display differently for whatever reason)
18  
  onSlack = hasImageOnScreen("#1005832") || hasImageOnScreen("#1005833");
19  
}
20  
21  
svoid printState(long time) {
22  
  done_always(time, onSlack
23  
    ? "You're on Slack!"
24  
    : "Slack window not visible.");
25  
  setConsoleIcon(onSlack ? "#1005832" : "#1005834");
26  
}
27  
28  
svoid shoot {
29  
  screen = shootScreenBW();
30  
}
31  
32  
// Simple version - searches full screenshot
33  
sbool hasImageOnScreen(S imageID) {
34  
  ret findImageSingle(screen, imageID, 1f) != null;
35  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005831
Snippet name: Recognize Slack [v1, WORKS]
Eternal ID of this version: #1005831/1
Text MD5: 6ce9a248ad4fa54f7b57dd0efbbc847e
Transpilation MD5: 7d3ed669e95a90db9286bf6c0e149ab7
Author: stefan
Category: javax / ocr
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-10 23:34:20
Source code size: 757 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 576 / 645
Referenced in: [show references]