Download Jar. Libraryless. Click here for Pure Java version (15009L/110K).
!7 !include #1015939 // PC Awareness Include static JLabel lblStatus; p { db(); if (match("i am aware", sendToLocalBotOpt_original("Awareness Bot", "are you aware"))) { print("Has awareness."); ret; } awt { showControls(lblStatus = jlabel("Setting Up Awareness...")); awtOnConceptChanges(lblStatus, 1000, f updateStatus); installTimer(lblStatus, 30000, f updateStatus); componentPopupMenu(lblStatus, voidfunc(JPopupMenu menu) { for (final MachineInfo info : findConcepts(MachineInfo, "me", false)) { if (!validPeer(info) || eq(osName(info), "Android")) continue; // Remote PC popup items follow addMenuItem(menu, "Grab clipboard from " + info.ip, r { S s = sendToAwareness(info.ip, "get clipboard"); if (nempty(s) && neq(s, "empty or unknown")) { L l = cast safeUnstructure(s); S type = cast first(l); if (eq(type, "text")) { S text = (S) l.get(1); copyTextToClipboard(text); print("Copied text to clipboard: " + quote(shorten(text, 100))); } else if (eq(type, "png")) { copyImageToClipboard(fromPNG((byte[]) l.get(1))); print("Copied image to clipboard."); } else print("Unknown clipboard type: " + type); } }); addMenuItem(menu, "Grab screenshot from " + info.ip, r { S s = sendToAwareness(info.ip, "screenshot"); if (startsWith(s, "[")) { L l = cast safeUnstructure(s); S type = cast first(l); if (eq(type, "png")) { BufferedImage img = fromPNG((byte[]) l.get(1)); showImage("Screenshot from " + info.ip + " at " + ymd_hms(), img); } } }); } }); } print("Yo Setting Up Awareness..."); makeBot("Awareness Bot."); phonePublicCommBot(); // works for PCs too findBot_timeout = 1000*60; pingThread(null); print("Awareness Set Up!"); printMyIPs(); scanSubnet_parallel(); notDoneQuietly(); } svoid updateStatus { new L<S> l; for (MachineInfo info : concatLists( findConcepts(MachineInfo, "me", true), findConcepts(MachineInfo, "me", false))) { if (!validPeer(info)) continue; l.add(info.ip + ": " + /*info.computerID*/ osName(info) + (info.me ? " [me]" : "")); } S text = isEmpty(l) ? "Looking for peers" : n(l, "machine") + ": " + join(", ", l); lblStatus.setText(text); }
Began life as a copy of #1004078
download show line numbers debug dex old transpilations
Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wtqryiryparv, zluxfztcnsid
No comments. add comment
Snippet ID: | #1005411 |
Snippet name: | PC Awareness |
Eternal ID of this version: | #1005411/7 |
Text MD5: | b644e72df5381291427e22f3b630104c |
Transpilation MD5: | 4ac04b58e4720f93a9fdea81ab253354 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-31 23:03:04 |
Source code size: | 2632 bytes / 84 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 762 / 2338 |
Version history: | 6 change(s) |
Referenced in: | #1003253 - New Homepage (LIVE) #1005763 - startAwareness - start PC Awareness or Android Awareness depending on platform #1015941 - PC Awareness [Dyn Module, old] |