Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Clicker help
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mrnitler




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
Euphoracle




PostPosted: Sun Apr 18, 2010 4:39 pm   Post subject: RE:Clicker help

look into java.awt.Robot maybe?
mrnitler




PostPosted: Wed Apr 21, 2010 10:20 pm   Post subject: Re: Clicker help

where can i find that?
Euphoracle




PostPosted: 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
Barbarrosa




PostPosted: 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.
andrew.




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: