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
6
votes
2 answers

Java Awt Robot changes Windows Mouse Speed

Every time I use Robot to move the mouse, it resets the Windows mouse speed. This is really annoying to deal with, and I was wondering if anyone knows how to fix this. Here is basically the code I am messing around with: Robot robot = new…
yathern
  • 319
  • 1
  • 3
  • 14
6
votes
3 answers

How to match similar colours in Java using getRGB

I am taking screenshots of the screen using robot and then searching for smaller images within those screenshots. This works on Windows but not OS X because of gamma correction. The best solution I can come up with is to simply match similar colours…
David Zorychta
  • 13,039
  • 6
  • 45
  • 81
6
votes
1 answer

Why is Robot.delay(int ms) limited to 1 minute?

I got the following exception while executing my software: Exception in thread "main" java.lang.IllegalArgumentException: Delay must be to 0 to 60,000ms at java.awt.Robot.checkDelayArgument(Robot.java:544) at…
BullyWiiPlaza
  • 17,329
  • 10
  • 113
  • 185
6
votes
1 answer

Java Robot for background (inactive) windows?

In Java, is it possible to use the Robot class to simulate keypresses to a Java window that is inactive (aka, that has been minimized to the background)?
Tom
  • 8,536
  • 31
  • 133
  • 232
6
votes
1 answer

java sending keystrokes using robot class

I know it's possible to send keystrokes in java using Robot Class , but is there any way to specify the target process when it's already started ?
Basil
  • 845
  • 9
  • 24
6
votes
3 answers

Faster alternative to java.awt.Robot.createScreenCapture?

I'm making a program that requires at least 24 screenshots per second to be captured. Currently with the code below I'm only getting 1 per every ~94 milliseconds, so about 10 per second. I'd prefer not to use any 3rd party libraries because I'm…
user2585313
6
votes
1 answer

Make a "Fake" mouse in java?

In java you can use the Robot Class to move the mouse and fire mouse clicks. While this is cool, it also "hijacks" the users mouse, so you cannot multitask. What I want to do is make a "Fake" mouse that acts independently of the system's mouse…
6
votes
3 answers

How to simulate Keyboard press in java

I want to simulate entering a string (can contain any character) in JTextField. I am using new KeyEventData() for that. But I am not able to determine how to handle characters like {, }, ) etc and also how to append a new character to already…
user1247412
  • 647
  • 7
  • 16
  • 29
6
votes
2 answers

Can I simulate game pad button presses with Java's Robot class (Java.awt.robot)?

I'm using an Arduino Uno to hook a (genuine) SNES controller to a computer via USB or Bluetooth. The Arduino captures the controller's button presses and releases using the snespad library. It communicates button presses and releases as characters…
keattsd
  • 69
  • 5
6
votes
2 answers

How to automate mouse and keyboard?

Can i write a java program to automate mouse movements and clicks ?? Like, then i will be able to run the program and it will work like some human being is controlling the machine.. I know about the Robot class. Will that be a solution. Any thought…
Anubis
  • 6,995
  • 14
  • 56
  • 87
5
votes
2 answers

Drag/Drop Robot Class

I would like to drag and drop using the Robot class in Java. For some reason the code below isn't working. Is there an alternative to this method? public static void main (String args []){ Robot robot = new Robot (); …
Nyx
  • 1,273
  • 6
  • 19
  • 32
5
votes
5 answers

Use a robot to type characters in Java

I know how to have Robot simulate a Y keypress like so: Robot.keyPress(KeyEvent.VK_Y); But how do I get Robot to press a quote and period?: ". Can anyone provide me some reference page or sample code?
5
votes
4 answers

Screenshot using Robot.createScreenCapture returning black image?

I'm trying to capture the screen using the below code on Windows 7 Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); BufferedImage capture = new Robot().createScreenCapture(screenRect); ImageIO.write(capture,…
Nomi Khurram
  • 101
  • 1
  • 11
5
votes
3 answers

Selenium Actions or Java AWT Robot?

Until now I have used the Selenium Actions library in order to perform mouse/keyboard actions in our automation project. Recently, I have discovered the Java AWT Robot class. How is it comparable to Selenium Actions library? Is there some…
Johnny
  • 14,397
  • 15
  • 77
  • 118
5
votes
3 answers

Java Robot class press Turkish letter (Ö, ö, Ş, ş, Ü, ü, Ğ, ğ, İ, ı, Ç, ç, Ə, ə)?

I have problem with press a special letter (Turkish etc.) via java robot class. I hava a method to press keys which works as alt+keycode. I cant convert some special letters to current keycode. So how can I solve it. Thanx For Example: KeyStroke ks…
Bertrand
  • 341
  • 1
  • 2
  • 12
1 2
3
44 45