Libraryless. Click here for Pure Java version (3232L/22K/74K).
1 | !752 |
2 | |
3 | p { |
4 | new StringReceiver receiver; |
5 | |
6 | // inject to all VMs |
7 | inject(receiver, [[ |
8 | for (JFrame f : allFrames()) { |
9 | L<JList> lists = findAll(f, JList.class); |
10 | if (l(lists) == 2) { |
11 | print("Yes! " + f.getTitle()); |
12 | receiver.add(weakref(f)); |
13 | } |
14 | } |
15 | ]]); |
16 | |
17 | print("Frames found: " + structure(receiver.list)); |
18 | } |
19 | |
20 | static void inject(StringReceiver receiver, S code) { |
21 | // change "receiver.add(" to "sendToLocalBot({port}, ..." |
22 | L<S> tok = javaTok(code); |
23 | jreplace(tok, "receiver.add(", |
24 | "sendToLocalBot(" + receiver.android.port + "," |
25 | + quote("please receive *") + ", "); |
26 | code = join(tok); |
27 | |
28 | // make & transpile program |
29 | S program = run752("p {\n" + code + "\n}"); |
30 | |
31 | S programID = createTempProgram(program, "Temp program by " + formatSnippetID(getProgramID())); |
32 | |
33 | // inject to VMs |
34 | L<Injection> injections = injectToAll(programID); |
35 | |
36 | // wait until injections ended |
37 | waitUntilInjectionsDone(injections); |
38 | |
39 | // release injections (TODO) |
40 | |
41 | // shut down receiver |
42 | receiver.android.dispose(); |
43 | } |
44 | |
45 | static class StringReceiver { |
46 | L<S> list = synchroList(); |
47 | Android3 android; |
48 | |
49 | *() { |
50 | android = new Android3("String Receiver."); |
51 | android.responder = new Responder() { |
52 | S answer(S s, L<S> history) { |
53 | new Matches m; |
54 | if (match3("please receive *", s, m)) { |
55 | list.add(m.unq(0)); |
56 | ret "OK."; |
57 | } |
58 | ret null; |
59 | } |
60 | }; |
61 | android.useMultiPort = false; |
62 | makeAndroid3(android); |
63 | } |
64 | } |
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
ID | Author/Program | Comment | Date |
---|---|---|---|
1161 | stefan | It has to transpile the program in every VM... will be optimized in new translation architecture. | 2015-11-01 13:33:30 |
Snippet ID: | #1001628 |
Snippet name: | Find frame with two lists (works e.g. with #1001622, but is slow, updating) |
Eternal ID of this version: | #1001628/1 |
Text MD5: | 8a1815702a9b50a1e0ef0900724156fb |
Transpilation MD5: | e0124a7834f5c46122e39d81a429e0c2 |
Author: | stefan |
Category: | |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-07-17 23:45:32 |
Source code size: | 1576 bytes / 64 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 1002 / 1012 |
Referenced in: | [show references] |