954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Robot class won't click the mouse

I have this code:

try
        {
            robot = new Robot();
            robot.mouseMove(0,900);
            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
        }catch(Exception e){}

And I want it to click the "Start" button on Windows computers. The mouse moves to the correct location, but does not click. Advice?

Ghost
Posting Whiz
352 posts since Aug 2004
Reputation Points: 12
Solved Threads: 2
 

it appears that Robot only works on swing buttons, and applications

sciwizeh
Posting Pro in Training
457 posts since Jun 2008
Reputation Points: 77
Solved Threads: 23
 
it appears that Robot only works on swing buttons, and applications

This is not true. Although this is what it was primarily intended.

Geazie
Newbie Poster
1 post since May 2009
Reputation Points: 10
Solved Threads: 0
 

try this instead. I had the same problem:

try
        {
            robot = new Robot();
            robot.mouseMove(0,900);
            robot.mousePress(InputEvent.BUTTON1_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_MASK);
        }catch(Exception e){}
Clawsy
Posting Whiz in Training
225 posts since Feb 2008
Reputation Points: 11
Solved Threads: 7
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You