[ANN] First release of Automations: XDo

M

Marvin Gülker

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
( 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top