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

38
LINES

< > BotCompany Repo | #1023485 // Key+Mouse Robot Socket Server

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

Uses 911K of libraries. Click here for Pure Java version (2427L/13K).

!7

cmodule KeyMouseRobot > DynPrintLog {
  switchable int port = 8084;
  
  start-thread {
    startDialogServer(port, new DialogHandler {
      public void run(DialogIO io) {
        while (io.isStillConnected()) {
          if (io.waitForLine()) {
            String line = io.readLineNoBlock();
            print(line);
            if (eq(line, "bye")) ret with io.sendLine("bye stranger");
            try {
              S answer = answer(line);
              io.sendLine(str(answer));
            } catch print e {
              io.sendLine(str(e));
            }
          }
        }
      }
    });
    ownResource(startDialogServer_serverSocket);
    startDialogServer_serverSocket = null;
    print("Listening to socket port " + port);
  }
  
  S answer(S s) {
    new Matches m;
    if (swic_trim(s, "mouseWheel ", m)) {
      awtRobot().mouseWheel(parseInt(m.rest()));
      ret "OK";
    }
      
    null;
  }
}

Author comment

Began life as a copy of #1023373

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023485
Snippet name: Key+Mouse Robot Socket Server
Eternal ID of this version: #1023485/8
Text MD5: 088f4b78b45f71fdfe7eb7792d89bfd9
Transpilation MD5: e6018e8ae2111e73a4d5dd191c9cc97e
Author: stefan
Category: javax / automation
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-06-25 00:04:29
Source code size: 964 bytes / 38 lines
Pitched / IR pitched: No / No
Views / Downloads: 264 / 544
Version history: 7 change(s)
Referenced in: [show references]