Computer Science Canada

Clicker help

Author:  mrnitler [ Sun Apr 18, 2010 3:41 pm ]
Post subject:  Clicker help

My mission in all of this is to create a program to click my desktop screen every few minutes
For example:
My desktop resolution is 1200x1200, and I want to click on pixel 800x800 every 3 minutes.
How would I go about doing that? Help is much appreciated.

Author:  Euphoracle [ Sun Apr 18, 2010 4:39 pm ]
Post subject:  RE:Clicker help

look into java.awt.Robot maybe?

Author:  mrnitler [ Wed Apr 21, 2010 10:20 pm ]
Post subject:  Re: Clicker help

where can i find that?

Author:  Euphoracle [ Wed Apr 21, 2010 10:59 pm ]
Post subject:  RE:Clicker help

http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Robot.html

Author:  Barbarrosa [ Thu Apr 22, 2010 7:56 pm ]
Post subject:  Re: Clicker help

I recommend Robot and MouseInfo (just google "java (Class/Interface)"). Don't forget to add a stopping mechanism, like a button or something.

I did 2 similar projects (which are posted in the Java Submissions section) that you may want to look at.

Author:  andrew. [ Thu Apr 22, 2010 9:08 pm ]
Post subject:  Re: Clicker help

Look into Robot. Here is an example:
Java:
   import java.awt.Robot;
   import java.awt.event.InputEvent;
   import java.awt.AWTException;

    public class RobotTest2
   {
       public static void main(String [] args)
      {
         try
         {
            while (true)
            {
               Robot robot = new Robot(); // Create a new robot
               robot.mouseMove(800,800); // Move the mouse to 800, 800
               robot.mousePress(InputEvent.BUTTON1_MASK); // Press mouse button
               robot.mouseRelease(InputEvent.BUTTON1_MASK); // Release mouse button
               robot.delay(60000); // 1 minute = 60000 ms
               robot.delay(60000);
               robot.delay(60000); // Do it 3 times
            }
         }
             catch (AWTException e)
            {
               e.printStackTrace();
            }
      }
   }


That should work.


: