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

!752

static bool onSlack;
static BWImage screen;

p {
  while licensed {
    sleepSeconds(1);
    long time = now();
    shoot();
    recognize();
    printState(time);
  }
}

svoid recognize {
  // Two versions for different browsers (Opera/Firefox display differently for whatever reason)
  onSlack = hasImageOnScreen("#1005832") || hasImageOnScreen("#1005833");
}

svoid printState(long time) {
  done_always(time, onSlack
    ? "You're on Slack!"
    : "Slack window not visible.");
  setConsoleIcon(onSlack ? "#1005832" : "#1005834");
}

svoid shoot {
  screen = shootScreenBW();
}

// Simple version - searches full screenshot
sbool hasImageOnScreen(S imageID) {
  ret findImageSingle(screen, imageID, 1f) != null;
}

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