!7 cmodule GMail > DynVisualBot { transient bool foundSomething; //transient RandomScreenScan scan = new(400, 100); transient IF1 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 rects = rects(info.segments); if (rects == null) continue; rects = ocr_mergeOverlappingY(rects); L texts = ocr_recognizeMultiLine_scored(img, rects); print(texts); //texts = ocr_mergeRecognizedTextsIfClose(texts); foundSomething = notNull(print(regexpFirstGroup_any(regexp, texts(texts)))); } print("Loop done (?!)"); } }