1

I'd want to send mouse clicks, keyboard presses to already opened 3rd party GUI application from my Ruby program.

How can I send mouse clicks, keyboard presses to Ubuntu?

Andrei Botalov
  • 20,686
  • 11
  • 89
  • 123
  • That depends on the GUI toolkit used in the application. – sawa Feb 18 '13 at 17:17
  • @sawa: it absolutely doesn't. – n. m. could be an AI Feb 18 '13 at 17:33
  • possible duplicate of [How to insert synthetic mouse events into X11 input queue](http://stackoverflow.com/questions/10319519/how-to-insert-synthetic-mouse-events-into-x11-input-queue) – n. m. could be an AI Feb 18 '13 at 17:40
  • @n.m. If you can specify the coordinates of the mouse pointer, then you might be able to do it along the answer in your link, but how would you know the positions of the icons on the application? In order to click the right widget, I think you need to access the application through its GUI toolkit. – sawa Feb 18 '13 at 17:47
  • @sawa: Not necessarily. – Linuxios Feb 18 '13 at 18:06
  • @sawa: the coordinates can be recorded once by a human clicking on these widgets, then played back many times. That's generally the way GUI programs are tested in the industry. – n. m. could be an AI Feb 18 '13 at 18:08

1 Answers1

2

Take a look at this autoit like app for Ubuntu. It's command-line so you can call it from Ruby

peter
  • 41,770
  • 5
  • 64
  • 108
  • I've implemented it using XDoTool. But [I encountered a problem](http://stackoverflow.com/questions/14979465/how-to-prohibit-user-to-change-os-window-focus-type-keys-for-several-seconds-on) – Andrei Botalov Feb 20 '13 at 20:12