Uses 911K of libraries. Click here for Pure Java version (16577L/92K).
1 | !7 |
2 | |
3 | cmodule GMail > DynVisualBot { |
4 | transient bool foundSomething; |
5 | //transient RandomScreenScan scan = new(400, 100); |
6 | transient IF1<Bool, Rect> scan = foundSomething -> rect(0, 0, 400, 100); |
7 | transient Rect lookingAt; |
8 | S regexp = "Inbox\\s?\\(([0-9,]+)"; |
9 | |
10 | start-thread { |
11 | // TODO: central module to thread registry |
12 | useShooter = false; // we shoot ourselves |
13 | if (segmenter == null) segmenter = mandatorySegmenterFromAGIBlue("find inbox count in task bar using standard gmail segmenter #1"); |
14 | while not null (lookingAt = scan.get(foundSomething)) pcall { |
15 | while (!enabled && !deleted) { |
16 | //print("Sleeping"); |
17 | sleepSeconds(1); |
18 | } |
19 | if (deleted) ret; |
20 | BufferedImage img = shootScreen2(lookingAt); |
21 | ImageInfo info = segment(img); |
22 | L<Rect> rects = rects(info.segments); |
23 | if (rects == null) continue; |
24 | rects = ocr_mergeOverlappingY(rects); |
25 | L<RecognizedText> texts = ocr_recognizeMultiLine_scored(img, rects); |
26 | print(texts); |
27 | //texts = ocr_mergeRecognizedTextsIfClose(texts); |
28 | foundSomething = notNull(print(regexpFirstGroup_any(regexp, texts(texts)))); |
29 | } |
30 | print("Loop done (?!)"); |
31 | } |
32 | } |
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
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: | 306 / 642 |
Version history: | 24 change(s) |
Referenced in: | [show references] |