Kid said:
Hi, I would like to simulate a Mouse click through Ruby. Is there a way
to do this through Ruby? Does Ruby have any library for simulating
mouse events. Can someone provide me with some info on this topic.
Thanks in advance.
KLUDGE:
Write a ruby script that outputs this to a file named Bot.java, runs
javac, then runs the JVM:
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
class Bot {
public static void main(String[] args) {
try {
Robot robot = new Robot();
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
} catch (AWTException e) {
e.printStackTrace();
}
}
}
Less of a kludge: Find how java.awt.Robot is implemented in C now that
Sun has relased Java as open source.
I hope mouse functionality is part of the standard library in Ruby2.