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

32
LINES

< > BotCompany Repo | #1025114 - GMail Inbox Checker [dev.]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 786K of libraries. Click here for Pure Java version (16577L/92K).

!7

cmodule GMail > DynVisualBot {
  transient bool foundSomething;
  //transient RandomScreenScan scan = new(400, 100);
  transient IF1<Bool, Rect> scan = foundSomething -> rect(0, 0, 400, 100);
  transient Rect lookingAt;
  S regexp = "Inbox\\s?\\(([0-9,]+)";
  
  start-thread {
    // TODO: central module to thread registry
    useShooter = false; // we shoot ourselves
    if (segmenter == null) segmenter = mandatorySegmenterFromAGIBlue("find inbox count in task bar using standard gmail segmenter #1");
    while not null (lookingAt = scan.get(foundSomething)) pcall {
      while (!enabled && !deleted) {
        //print("Sleeping");
        sleepSeconds(1);
      }
      if (deleted) ret;
      BufferedImage img = shootScreen2(lookingAt);
      ImageInfo info = segment(img);
      L<Rect> rects = rects(info.segments);
      if (rects == null) continue;
      rects = ocr_mergeOverlappingY(rects);
      L<RecognizedText> texts = ocr_recognizeMultiLine_scored(img, rects);
      print(texts);
      //texts = ocr_mergeRecognizedTextsIfClose(texts);
      foundSomething = notNull(print(regexpFirstGroup_any(regexp, texts(texts))));
    }
    print("Loop done (?!)");
  }
}

download  show line numbers  debug dex   

Travelled to 2 computer(s): mqqgnosmbjvj, tvejysmllsmz

No comments. add comment

Snippet ID: #1025114
Snippet name: GMail Inbox Checker [dev.]
Eternal ID of this version: #1025114/25
Text MD5: 0ae1174f77d52e25e72c6f53f9f36bf9
Transpilation MD5: 19e15da920dd49936ed7cf286e120722
Author: stefan
Category: javax / ocr bots
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-10 01:54:55
Source code size: 1216 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 76 / 349
Version history: 24 change(s)
Referenced in: [show references]