Automatic Mouse click, Key Press Script in Java


By Java, you can perform automatic mouse clicks, keyboard press etc. 🙂

I’ve created a short application by which you can make automatic mouse click in a certain co-ordinate! 😉

Download Source/Executable

Download from GoogleCode (source/executable)

Please note:  This is not any professional application, if you want to use professional mouse-recording or macro-recorder for presentation or other tasks, use other software.

If you want only to run the executable file, run the .jar file. You must have JRE installed in your computer 😉

How it works?

Java has a class Robot which dedicated for performing these activities. I simply used the class. More documentation here, and analysis the source code uploaded.

6 thoughts on “Automatic Mouse click, Key Press Script in Java

  1. The code freezes in Ubuntu. Add this line:
    trainer.mouseRelease(InputEvent.BUTTON1_MASK);
    after this line in the original code (mouse.java):
    trainer.mousePress(InputEvent.BUTTON1_MASK);

    And everything works just fine. Complete code is available here

    1. “Please note: This is not any professional application, if you want to use professional mouse-recording or macro-recorder for presentation or other tasks, use other software.”

      I would like to use this with a program that I want to build, but when you say Automatic

      mouse click is not a professional application, well if the application that I was going to build

      would be professional and I credited you by listing you as the maker of this particular

      module/toolkit/program, then would that would be ok right? Please dont sue me.

  2. yea it works however in the source code all you needed to do was add the line trainer.mouseRelease(InputEvent.BUTTON1_MASK); in the while loop so that it will act like a mouse click other than that great coding

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s