!7 sclass AllOnlineComputers extends DynCalculatedList { LS computerIDs, data; transient StefansOS_ConnectToServer connector; L calc() { ret data; } start { ownResource(connector = new StefansOS_ConnectToServer); connector.onLine = voidfunc(S line) { new Matches m; if (swic(line, "ComputerIDs = ", m)) { computerIDs = safeUnstruct($1); fO computerNames = dm_computerNames_opt(); setField(data := sortedIC(map(computerIDs, func(S id) -> S { S name = dm_callOpt(computerNames, 'nameForID, id); ret (eq(id, computerID()) ? "[this one] " : "") + (nempty(name) ? name + " (" + id + ")" : id); }))); vmBus_send('onlineComputerIDs, computerIDs); setModuleName(n2(computerIDs, "Online Computer")); } }; connector.startWithSubs("computerIDs"); } afterVisualize { listPopupMenuItem("Send clipboard there", rThread { S computerID = selected(); if (computerID != null) dm_sendClipboardTo_verbose(computerID); }); } // API LS onlineComputerIDs() { ret computerIDs; } }