Is it possible to set/move the mouse pointer's location directly from Mathematica without using external tools like Run["xdotool mousemove x y"]?
$\begingroup$ $\endgroup$
3 - 2$\begingroup$ If an interactive application like Mathematica did that, I would consider it a bug... Anyway, I don't think it's possible from within Mathematica. $\endgroup$Jens– Jens2012-08-12 02:50:54 +00:00Commented Aug 12, 2012 at 2:50
- $\begingroup$ You don't mean setting the current insertion point or selection? $\endgroup$Sjoerd C. de Vries– Sjoerd C. de Vries2012-08-12 06:55:35 +00:00Commented Aug 12, 2012 at 6:55
- $\begingroup$ not the selection inside Mathematica. Just moving the mouse pointer anywhere inside the screen $\endgroup$my account_ram– my account_ram2012-08-15 06:34:20 +00:00Commented Aug 15, 2012 at 6:34
Add a comment |
1 Answer
$\begingroup$ $\endgroup$
9 Needs["JLink`"] ReinstallJava[] robotclass=JavaNew["java.awt.Robot"] robotclass@mouseMove[#,300]&/@Range@900; - 3$\begingroup$ Impressive .. :) $\endgroup$Dr. belisarius– Dr. belisarius2012-08-21 00:50:28 +00:00Commented Aug 21, 2012 at 0:50
- 1$\begingroup$ Second that, impressive indeed, +1. $\endgroup$Leonid Shifrin– Leonid Shifrin2012-08-21 00:53:47 +00:00Commented Aug 21, 2012 at 0:53
- 5$\begingroup$ +1 Great ;-)
Table[robotclass@mouseMove[Round[300 (Cos[x] + 1)], Round[100 (Sin[2 x] + 1)]], {x, 0, 2 Pi, .001}];$\endgroup$Vitaliy Kaurov– Vitaliy Kaurov2012-08-21 01:25:51 +00:00Commented Aug 21, 2012 at 1:25 - 2$\begingroup$ Impressive?? That's scary... $\endgroup$sebhofer– sebhofer2012-10-19 08:41:44 +00:00Commented Oct 19, 2012 at 8:41
- 2$\begingroup$ @John: No, it's not. a) in the example of the o/p xdotool would be an external tool/application/program that you'd need to call. b) JLink is part of M, and WRI's official position is that this makes all of Java part of M (same with NETLink and .Net), as indicated by marketing materials. c) you ARE actually writing this in M. My code above is NOT Java code, it's M code. It just LOOKs like Java code (and that's a smart design choice of JLink/NETLink), but it isn't. These are all M symbols, it's M syntax, it runs from the M f/e, and it is executed/"scripted" through the kernel. $\endgroup$Andreas Lauschke– Andreas Lauschke2013-11-11 16:03:36 +00:00Commented Nov 11, 2013 at 16:03