[ANN] First release of Automations: XDo

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.

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

require “xdo/keyboard”
#Send some text to the active window
#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
#Close it
#Or even force it to close

The XDo library is based on several command-line tools, of which xdotool
( xdotool - fake keyboard/mouse input, window management, and more - semicomplete ) 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/

I hope, it’s useful in some way! :wink: