!747 !pcall m { static S botID = "#1001756"; static S botName = "Get Selected Table Line Helper Bot"; static S cmd = "get selected table line as map"; p { makeAndroid3("Get Selected Table Line Bot."); } static S answer(S s) { if (match3("get selected table line as map", s)) { new TreeMap results; for (DialogIO vm : talkToAllOtherVMs()) { pcall { int vmPort = vm.getPort(); Map bots = (Map) safeUnstructure(vm.ask("list bots")); print("VM " + vmPort + " bots: " + structure(bots)); if (!containsBot(bots, botName)) { print("Injecting bot."); injectTo(vmPort, botID); int safetyCount = 0; while (!containsBot((Map) safeUnstructure(vm.ask("list bots")), botName)) { if (safetyCount >= 100) fail("bot did not start"); sleep(500); } } S result = vm.ask("please forward to bot *: *", botName, cmd); results.put(vmPort, result); } vm.close(); } // include myself Component focus = getFocusOwner(); if (focus instanceof JTable) results.put(myVMPort(), structure(getSelectedLineAsMap((JTable) focus))); Map result = getResult(results); ret structure(result); } ret null; } static Map getResult(Map results) { for (S s: results.values()) if (structIsMap(s)) ret (Map) unstructure(s); ret null; } }