0

Hello all

Im trying to make java robot hold down the command key.

I have used the following code.

robot.keyPress(KeyEvent.VK_META);
robot.Delay(5000);
robot.keyRelease(KeyEvent.VK_META);

This doesant seem to do the trick. Yes I have searched on how to do this but cannot find a working answer.
Am I using the wrong keycode?

Ive also tried

  robot.keyPress(KeyEvent.META_MASK);
 and 

 robot.keyPress(KeyEvent.META_DOWN_MASK);

Ive also tried keycodes, 91 and 93.

Edited by scheppy

2
Contributors
2
Replies
17
Views
2 Years
Discussion Span
Last Post by JamesCherrill
0

Sorry man, the first version looks right to me. Maybe it's OK but there's some other problem that makes it look like its not working?
If you post a runnable test program I can check it out on my Macs.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.