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

47
LINES

< > BotCompany Repo | #1001752 // Get selected table line (search all VMs)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Transpiled version (1614L) is out of date.

1  
!747
2  
!pcall
3  
4  
m {
5  
  static S botID = "#1001756";
6  
  static S botName = "Get Selected Table Line Helper Bot";
7  
  static S cmd = "get selected table line as map";
8  
  
9  
  p {
10  
    new TreeMap<int, S> results;
11  
    for (DialogIO vm : talkToAllOtherVMs()) {
12  
      pcall {
13  
        int vmPort = vm.getPort();
14  
        Map<Number, S> bots = (Map) safeUnstructure(vm.ask("list bots"));
15  
        print("VM " + vmPort + " bots: " + structure(bots));
16  
        if (!containsBot(bots, botName)) {
17  
          print("Injecting bot.");
18  
          injectTo(vmPort, botID);
19  
          
20  
          int safetyCount = 0;
21  
          while (!containsBot((Map) safeUnstructure(vm.ask("list bots")), botName)) {
22  
            if (safetyCount >= 100) fail("bot did not start");
23  
            sleep(500);
24  
          }
25  
        }
26  
        S result = vm.ask("please forward to bot *: *", botName, cmd);
27  
        results.put(vmPort, result);
28  
      }
29  
      vm.close();
30  
    }
31  
    
32  
    // include myself
33  
    Component focus = getFocusOwner();
34  
    if (focus instanceof JTable)
35  
      results.put(myVMPort(), structure(getSelectedLineAsMap((JTable) focus)));
36  
      
37  
    Map result = getResult(results);
38  
    print("Result: " + structure(result));
39  
  }
40  
  
41  
  static Map getResult(Map<int, S> results) {
42  
    for (S s: results.values())
43  
      if (structIsMap(s))
44  
        ret (Map) unstructure(s);
45  
    ret null;
46  
  }
47  
}

Author comment

Began life as a copy of #1001738

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1001752
Snippet name: Get selected table line (search all VMs)
Eternal ID of this version: #1001752/2
Text MD5: c66e8982397c52874020811335c8c88a
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-11 22:55:30
Source code size: 1396 bytes / 47 lines
Pitched / IR pitched: No / No
Views / Downloads: 527 / 576
Version history: 1 change(s)
Referenced in: [show references]