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

33
LINES

< > BotCompany Repo | #1033110 // Crop & JPEGify new screenshots [probably works for Stefan only]

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

Transpiled version (11018L) is out of date.

!7

cm CropAndJPEGify > DynPrintLogAndEnabled {
  transient FileWatchService watchService;
  transient ReliableSingleThread_Multi<File> rst = dm_rstMulti(me(), lambda1 processFile);
  switchable int width = 1280; // width of right monitor in fact
  switchable bool left;
  
  start {
    ownResource(watchService = new FileWatchService);
    File dir = desktopDir();
    
    watchService.addListener(dir, f -> rst.add(f),
      jdk_watchService_allEventKinds());
    
    print("Watching " + dir);
  }
  
  void processFile(File f) {
    if (!enabled) ret;
    if (!fileExtensionIs(f, ".png")) ret;
    if (contains(fileName(f), "uncropped")
      || fileExists(appendToBaseFileName(f, ".uncropped")))
      ret;
    sleepSeconds(1); // allow file to settle
    if (!fileExists(f)) ret;
    if (left)
      cropToLeftScreenInPlace(f, screenWidth(0));
    else
      cropToRightScreenInPlace(f, width);
    jpegify(f);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

-
Snippet ID: #1033110
Snippet name: Crop & JPEGify new screenshots [probably works for Stefan only]
Eternal ID of this version: #1033110/10
Text MD5: f5a4dc0ae153e8b362e67ef6af572174
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-31 02:40:35
Source code size: 924 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 183 / 724
Version history: 9 change(s)
Referenced in: