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).

1  
!7
2  
3  
cmodule KeyMouseRobot > DynPrintLog {
4  
  switchable int port = 8084;
5  
  
6  
  start-thread {
7  
    startDialogServer(port, new DialogHandler {
8  
      public void run(DialogIO io) {
9  
        while (io.isStillConnected()) {
10  
          if (io.waitForLine()) {
11  
            String line = io.readLineNoBlock();
12  
            print(line);
13  
            if (eq(line, "bye")) ret with io.sendLine("bye stranger");
14  
            try {
15  
              S answer = answer(line);
16  
              io.sendLine(str(answer));
17  
            } catch print e {
18  
              io.sendLine(str(e));
19  
            }
20  
          }
21  
        }
22  
      }
23  
    });
24  
    ownResource(startDialogServer_serverSocket);
25  
    startDialogServer_serverSocket = null;
26  
    print("Listening to socket port " + port);
27  
  }
28  
  
29  
  S answer(S s) {
30  
    new Matches m;
31  
    if (swic_trim(s, "mouseWheel ", m)) {
32  
      awtRobot().mouseWheel(parseInt(m.rest()));
33  
      ret "OK";
34  
    }
35  
      
36  
    null;
37  
  }
38  
}

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: 265 / 547
Version history: 7 change(s)
Referenced in: [show references]