Tell me more ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Is it possible to set/move the mouse pointer's location directly from Mathematica without using external tools like Run["xdotool mousemove x y"]?

share|improve this question
2  
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. – Jens Aug 12 '12 at 2:50
You don't mean setting the current insertion point or selection? – Sjoerd C. de Vries Aug 12 '12 at 6:55
not the selection inside Mathematica. Just moving the mouse pointer anywhere inside the screen – my account_ram Aug 15 '12 at 6:34

1 Answer

up vote 24 down vote accepted
Needs["JLink`"]
ReinstallJava[]
robotclass=JavaNew["java.awt.Robot"]
robotclass@mouseMove[#,300]&/@Range@900;
share|improve this answer
2  
Impressive .. :) – belisarius Aug 21 '12 at 0:50
1  
Second that, impressive indeed, +1. – Leonid Shifrin Aug 21 '12 at 0:53
2  
+1 Great ;-) Table[robotclass@mouseMove[Round[300 (Cos[x] + 1)], Round[100 (Sin[2 x] + 1)]], {x, 0, 2 Pi, .001}]; – Vitaliy Kaurov Aug 21 '12 at 1:25
Excellent - that seems like a prime candidate for causing some desktop mischief ;-) – Yves Klett Aug 21 '12 at 7:00
Very nice Andreas. +1. Java rules! – Rolf Mertig Aug 21 '12 at 9:55
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.