Download Jar. Uses 4281K of libraries. Click here for Pure Java version (14025L/98K).
1 | !7 |
2 | |
3 | static double interval = 1.0; |
4 | static new LatestAppearance<S> latest; |
5 | sS tooltip; |
6 | static RectAndMD5 mouse; |
7 | static Rect rectShown; |
8 | static int maxClipWidth = min(600, screenWidth()/2); |
9 | static int maxClipHeight = min(300, screenHeight()/2); |
10 | |
11 | p-subst { |
12 | autoRestart(); |
13 | startBotHere("Screen Segmenter.", #1015121); |
14 | |
15 | onGlobalKeyPress(voidfunc(NativeKeyEvent e) { |
16 | mechAppend_noUniq_inQ("Key log", |
17 | "User pressed key " + e.getKeyCode() + " with modifiers " + e.getModifiers()); |
18 | }); |
19 | |
20 | onGlobalMousePress(voidfunc(NativeMouseEvent e) { |
21 | lock defaultLock(); |
22 | int x = e.getX(), y = e.getY(); |
23 | makeToolTip(Pt(x, y)); |
24 | S text; |
25 | if (mouse == null) |
26 | text = "User clicked at " + x + "/" + y + " (" + screenWidth() + "x" + screenHeight() + ")"; |
27 | else |
28 | text = "User clicked on " + (empty(tooltip) ? "uncommented object of size " + mouse.r.w + "x" + mouse.r.h : multiLineQuote(tooltip)) + " at " + x + "/" + y + " (screen: " + screenWidth() + "x" + screenHeight() + ", rect: " + mouse.r + ", md5: " + mouse.md5 + ")"; |
29 | mechAppend_noUniq_inQ("Mouse log", text); |
30 | }); |
31 | |
32 | S tooltip = ""; // mouse |
33 | repeat with sleep interval { |
34 | time2 { |
35 | L<S> list = latest.recordAndSort(thingsOnScreen2()); |
36 | |
37 | makeToolTip(mousePt()); |
38 | } |
39 | print(localDateWithSeconds() + ": Found: " + list); |
40 | consoleTitle(l(list) + " " + joinWithComma(list)); |
41 | } |
42 | } |
43 | |
44 | svoid makeToolTip(Pt mousePt) { |
45 | lock defaultLock(); |
46 | L<RectAndMD5> rects = segmentedScreenFromCacheFile_last; |
47 | mouse = firstRectAndMD5Containing(rects, mousePt); |
48 | S name = ""; |
49 | |
50 | if (mouse != null) |
51 | name = unnull(thingsOnScreenDefinitions().get(mouse.md5)); |
52 | if (neq(name, tooltip)) flatInfoBox_topRightCorner(tooltip = name, 1.0); |
53 | |
54 | Rect r = mouse == null ? null : mouse.r; |
55 | if (r != null && empty(name) && neq(r, rectShown) |
56 | && r.w <= maxClipWidth && r.h <= maxClipHeight) { |
57 | double zoom = 1; |
58 | int x = max(r.w, r.h); |
59 | if (x < 30) zoom = 3.0; |
60 | else if (x < 100) zoom = 2.0; |
61 | ImageSurface is = zoomedImageSurface(shootScreenArea_possiblyBroken(mouse.r), zoom); |
62 | showWindowInTopRightCorner(is, 3.0); |
63 | } |
64 | rectShown = r; |
65 | } |
Began life as a copy of #1015126
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1015142 |
Snippet name: | Mouse ToolTip & Log & Key Log [OK] |
Eternal ID of this version: | #1015142/1 |
Text MD5: | 089d4a74383855489d138096031957d3 |
Transpilation MD5: | 201f0ba333602e7664f9a9724483c41a |
Author: | stefan |
Category: | javax / ocr |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-08 21:12:47 |
Source code size: | 2213 bytes / 65 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 470 / 1073 |
Referenced in: | [show references] |