Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Macro recorder/player

I am making a sort of Macro recorder/player

I have done the player part with utils such as java.awt.Robot() which emulates basic human mouse/keyboard output commands, reading an XML file.

I am stuck at the part where I have to record that XML file. I have no idea of which Class I can use to do the opposite of Robot() If yo have any FemaleRobot() for me I would be very happy :D

The only thing in this direction I have so far is :

   while (true) {
        Point pos = MouseInfo.getPointerInfo().getLocation();
        System.out.println(pos.x+" x "+pos.y);
   }

which is not much and not really what I want ^_^, I don't know how to use a Mouse/KeyListener since it would require a Component. If it is the only way, what Compoment do I use as I don't want any graphical java implementation? Should I create a phony Component anyway? Which one?

e.g. I want my recorder to write in the XML how I click on my ubuntu desktop or press enter on firefox.

I guess it's clear, if not I will be checking the answers a lot. Have a nice day and thanks for reading this.

like image 201
sinekonata Avatar asked Jan 06 '12 01:01

sinekonata


1 Answers

Try jnativehook lib: http://code.google.com/p/jnativehook/wiki/examples

It is very easy to use and may meet your needs.

like image 84
Jovo Krneta Avatar answered Oct 05 '22 05:10

Jovo Krneta