# \[ANN\] First release of Automations: XDo

**URL:** <https://www.ruby-forum.com/t/ann-first-release-of-automations-xdo/174246>\
**Category:** Ruby\
**Created:** [August 23, 2009, 11:25am UTC](https://www.ruby-forum.com/t/ann-first-release-of-automations-xdo/174246 "2009-08-23T11:25:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![quintus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/49beb7/32.png) [@quintus](https://www.ruby-forum.com/u/quintus)\
**Post date:** [August 23, 2009, 11:25am UTC](https://www.ruby-forum.com/t/ann-first-release-of-automations-xdo/174246/1 "2009-08-23T11:25:14Z")

</div>

Hi folks,

## I’m happy to announce the first public release of the XDo library. It allows you to fake and automate (simulate) user input to a Linux X Server system like Ubuntu. Possibilities include mouse and keyboard automation as well as window manipulation and some more. Examples:

require “xdo/mouse”

#Click somewhere  
XDo::Mouse.click(123, 456) #position in pixels  
#Do a drag&drop  
XDo::Mouse.drag(40, 40, 100, 100)  
#Execute a click at the current cursor position  
XDo::Mouse.click

require “xdo/keyboard”  
#Send some text to the active window  
XDo::Keyboard.type(“abcdefg”)  
#Send special keyboard strokes  
XDo::Keyboard.simulate(“AB{ESC}CD”) #Sends A and B, than [ESC] and than  
C and D  
#type is faster, but does not recognize chars like Ã¤ or {ESC}.  
#And yes, I’m inspired by AutoIt for Windows.

## require “xdo/xwindow” #Get a list of all open gedit windows gedits = XDo::XWindow.search(“gedit”) #Pass in only parts of the title #Get a (pseudo) reference to the first gedit gedi = XDo::XWindow.new(gedits.first) #Or use from\_name as a shortcut gedi = XDo::XWindow.from\_name(“gedit”) #Move the window gedi.move(100, 100) #Resize it gedi.resize(500, 500) #Get the full title gedi.title #Close it gedi.close #Or even force it to close gedi.kill!

The XDo library is based on several command-line tools, of which xdotool  
( [xdotool - fake keyboard/mouse input, window management, and more - semicomplete](http://www.semicomplete.com/projects/xdotool/) ) is the most important  
one, since it is used for the three main components of XDo shown above.  
If your distribution allows, you can simply use  
sudo apt-get install xdotool  
. To get xdo, do  
sudo gem install xdo  
.  
The project is hosted on RubyForge: [http://rubyforge.org/projects/auto/](http://rubyforge.org/projects/auto/)

I hope, it’s useful in some way! 😉

Marvin
