Xdotool is a program that can simulate keyboard and mouse events. It can be used to establish real “scenarios” action replay. Unlike randtype seen recently xdotool not confined to the terminal. It is also able to manipulate the windows of your graphical environment.
For rpm-based distribution, open a terminal as root and run the following command:
yum install xdotool
Or this one for a distrbution based on Debian:
sudo apt-get install xdotool
Examples of using xdotool
Xdotool can be used in command line for simple actions. The-h you will get help.
But in most cases, you will need to combine multiple events. Using a script will be the best solution. Here is an example of what can be achieved with:
#!/bin/bash
WID=`xdotool search –title “Mozilla Firefox” | head -1`
xdotool windowfocus $WID
xdotool key ctrl+l
xdotool type “www.redcodenetwork.ro”
xdotool key “Return”
This script makes in order the following actions:
* Search the id of the Firefox window
* Switch to that window
* Use keyboard shortcut Ctrl + l – to select the addressbar
* Write the address of redCode Net.Work
* press the enter key
We could have gone even further, by moving the mouse cursor and clicking on a link:
xdotool mousemove 500 500
xdotool click 1
Xdotool possibilities are interesting. Feel free to create your own scenarios.
3 Comments
andykimpe
lol centos 6
yum install xdotool
# yum -y install xdotool
$Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.ovh.net
* epel: mirrors.ircam.fr
* extras: centos.mattclements.co.uk
* updates: mirror.ovh.net
Setting up Install Process
No package xdotool available.
Error: Nothing to do
sic
xdotool is provided by the nux dextop repository
andykimpe
ok is rumming
yum groupinstall ‘Development Tools’ -y
yum install libXi-devel libXtst-devel libXinerama-devel git -y
git clone https://github.com/jordansissel/xdotool.git
cd xdotool
make
make install