Generating keyboard and mouse input without actually pressing them can be done by command ‘xautomation’.
There are 2 commands to run xautomation: xte and xdotool.
Examples:
Move the cursor to a certain position (x,y):
xte ‘mousemove x y’
or
xdotool mousemove x y
Press a button on the keyboard:
xte ’key a’
or
xdotool key a
Type a string:
xte ‘str abcd’
or
xdotool type abcd
Click mouse left button:
xte ‘mouseclick 1′
or
xdotool click 1
Get current cursor position:
xdotool getmouselocation
(xte has no command).
Advertisement
thank you very much needed the mouseclick thing for a flashgame to safe the life of my (computer-)mouse (:
By: _ on August 13, 2010
at 6:08 pm
it’s very useful but I don’t more know.
By: cheapflightstoasiandestinations on April 16, 2011
at 1:06 pm
Mouse Input in Linux is very important commant. It’s related with mouse event.
By: flightstonorthamerica on April 18, 2011
at 12:45 pm