Questions tagged [awtrobot]

The Robot class (java.awt.Robot) is used to programmatically trigger input events such as key press events and mouse actions & can also perform screenshot capture.

The Robot class (java.awt.Robot) is used to programmatically trigger input events, such as key press events and mouse actions & can also perform capture.

For Example:

Example of Java Robot Programming

662 questions
5
votes
2 answers

simulate backspace key with java.awt.Robot

There seems to be an issue simulating the backspace key with java.awt.Robot. This thread seems to confirm this but it does not propose a solution. This works: Robot rob = new Robot(); rob.keyPress(KeyEvent.VK_A); rob.keyRelease(KeyEvent.VK_A); This…
Tyler
  • 4,679
  • 12
  • 41
  • 60
5
votes
1 answer

How can I kill a rogue robot?

I am (ab)using Java's Robot class to automate some clicking tasks in a browser window. On the first click, the Java application loses focus. If the robot begins misbehaving, I would like to terminate the program. However, I cannot easily do so…
augurar
  • 12,081
  • 6
  • 50
  • 65
5
votes
7 answers

Java app makes screen display unresponsive after 10 minutes of user idle time

I've written a Java app that allows users to script mouse/keyboard input (JMacro, link not important, only for the curious). I personally use the application to automate character actions in an online game overnight while I sleep. Unfortunately, I…
Ross
  • 3,709
  • 8
  • 35
  • 33
5
votes
2 answers

Java awt.Robot: CTRL+ALT+DEL does not bring up desired screen

I just recently found out about the awt.Robot Library and I'm quite excited to get to use it. I thought I'd play a little prank on my friend and have the robot press control,alt,delete press the lock the computer button but I can't get the program…
Bobby Strickland
  • 175
  • 4
  • 14
5
votes
1 answer

Sending KeyEvents to a Process

I am trying to send keyboard commands to a game emulator from my Java program, I know how to set up the process from processbuilder and run the process. However, I'm still having trouble with sending the process keyboard commands from my Robot. An…
Bskogen
  • 51
  • 3
5
votes
1 answer

override the rate settings of the mouse. Creating my own mouse rate algorithm

I am working with disabled children, who have cerebral palsy. One child has limited fine motor control, so she currently uses a joystick to control the mouse, and it's traverse rate is set very low. This works well for her, as she can click all…
samjewell
  • 1,068
  • 11
  • 20
5
votes
1 answer

change mouse buffer with java

I am creating a robot using java, but there is an application which has an special and strong security and I cannot execute my robot over there, for some reason that I don't know, my robot cannot change the mouse position when such application is…
5
votes
1 answer

Is there a faster way to get the colors in a screen-shot?

I have piece of code, and what it does is find the colors of an image (or section of the screen) and if the R G and B color's are greater than 127 it put's a 1 in the corresponding position of a 2D int array. Here is the segment I have now, but it…
jocopa3
  • 796
  • 1
  • 10
  • 29
4
votes
4 answers

Trying to paint image to JFrame with Java BufferedImage, Graphics

I'm trying to capture the screen and then paint the image to a JFrame recursively while scaling the image (to create that effect you get when you look at a mirror in a mirror). I'm having trouble with my code - it doesn't paint any graphics. What am…
Ozzy
  • 8,244
  • 7
  • 55
  • 95
4
votes
3 answers

How to move a mouse smoothly throughout the screen by using java?

There is a mouseMove()method that makes the pointer jump to that location. I want to be able to make the mouse move smoothly throughout the screen. I need to write a method named mouseGLide() which takes a start x, start y, end x, end y, the total…
user1205958
  • 75
  • 1
  • 2
  • 5
4
votes
5 answers

Robot class java , typing a string issue

I m using the following loop , but its only typing the first charecter and the rest as numbers, any idea ? import java.awt.*; import javax.swing.KeyStroke; public class test { public static void main(String[] args) throws AWTException { …
wam090
  • 2,823
  • 8
  • 33
  • 36
4
votes
4 answers

Macro recorder/player

I am making a sort of Macro recorder/player I have done the player part with utils such as java.awt.Robot() which emulates basic human mouse/keyboard output commands, reading an XML file. I am stuck at the part where I have to record that XML…
sinekonata
  • 364
  • 3
  • 11
4
votes
2 answers

Using Java Robot class. Ways to halt execution of the program?

I've used the Robot class in java numerous times as a quick workaround on menial tasks. Stopping execution is always a problem (which needs to be numerous times during testing). What I want is a KeyListener that will listen for a key/combination of…
Chad
  • 2,335
  • 8
  • 29
  • 45
4
votes
2 answers

Problems with java Robot. mouse click not working

I'm having problems with the java robot, I'm using it to make a pixel bot for a game. when i use the robot to click nothing happens, i have heard that there are more problems with people can't click certain apps. But i couldn't find any solutions…
jeroen
  • 41
  • 2
  • 4
4
votes
2 answers

How can I make Robot press and hold a mouse button for a certain period of time?

I am using Java to generate a mouse press using the Robot class: robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); However, I want the Robot to press the button for a certain period of time. How can I achieve…
Neutralise
  • 189
  • 2
  • 2
  • 6