From: "Marvin Gülker" Date: 2009-08-23T18:25:17+09:00 Subject: [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. 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 . The project is hosted on RubyForge: http://rubyforge.org/projects/auto/ I hope, it's useful in some way! ;-) Marvin -- Posted via http://www.ruby-forum.com/.