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

27
LINES

< > BotCompany Repo | #1024982 // ScreenShooter

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (6074L/43K).

sclass ScreenShooter implements AutoCloseable {
  transient L onNewImage = syncList(); // L<Runnable|voidfunc(BufferedImage)>
  
  transient BufferedImage latestImage;
  double interval = 1.0;
  transient java.util.Timer timer;
  bool verbose = true;
  bool enabled = true;
  
  ScreenShooter start(O... _) {
    /*IF0<AutoCloseable>*/ O enter = optPar enter(_);
    timer = doEvery(interval, r {
      ret unless enabled;
      temp asAutoCloseable(callF(enter));
      long time = sysNow();
      latestImage = shootScreen2();
      if (verbose) done2_always(time, "Screenshot");
      pcallFAll(onNewImage, latestImage);
      vmBus_send newScreenShot(latestImage);
    });
    this;
  }
  
  public void close() {
    dispose timer;
  }
}

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: #1024982
Snippet name: ScreenShooter
Eternal ID of this version: #1024982/9
Text MD5: 9c338e8bdc3a653ac3a2feef685e20a1
Transpilation MD5: 87693d3ce97db04621e3fe4fd5a7934b
Author: stefan
Category: javax / visual bots
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-31 22:56:15
Source code size: 768 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 273 / 697
Version history: 8 change(s)
Referenced in: [show references]