!747 !pcall m { p { 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, "Get Active Swing Component Bot")) { print("Injecting bot."); injectTo(vmPort, "#1001734"); } S result = vm.ask("please forward to bot *: *", "Get Active Swing Component Bot", "get active component"); results.put(vmPort, result); } vm.close(); } // include myself results.put(myVMPort(), weakref(KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner())); print("Results: " + structure(results)); } static boolean containsBot(Map bots, S botName) { for (S bot : bots.values()) if (startsWithIgnoreCase(bot, botName)) ret true; ret false; } }