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
4
votes
3 answers

Java Robot mouse move: setting speed?

The Java Robot class allows one to move the mouse as if the actual physical mouse was moved. However, how does one move the mouse from Point1 to Point2 in a humane (and thus not instant) manner? Aka, how does one set the speed of movement? If no…
Tom
  • 8,536
  • 31
  • 133
  • 232
4
votes
0 answers

java.awt.Robot emulating Keys on different Keyboard Layouts and locale

I have a Java remote application which emulates keyboard on remote PC using AWT Robot. If the remote user presses the extended keys on the keyboard and the keyboard locale is not en_US, the extended keys will not display. To be specific the AWT…
Sid
  • 41
  • 4
4
votes
1 answer

Upload file from project directory

Im trying to upload a file from my projects root folder using Robot Framework and Java. When the popup window opens, the root file path is sent to popup but the popup never closes to submit the file. If i change the file path to the desktop the…
user1798578
  • 221
  • 3
  • 12
4
votes
0 answers

Java Robot Moves Mouse To The Incorrect Coordinates

public class R0b0t { public static void main(String[] args) throws Exception { Robot robot; robot = new Robot(); robot.mouseMove(50,50); } } The code above is a simple program that moves the mouse to the…
J0nathan Lam
  • 141
  • 1
  • 3
  • 10
4
votes
2 answers

Robot.delay(int) versus Thread.sleep(long)

I have a program whose only purpose is to drive a java.awt.Robot in an infinite loop until an exit condition is met. The robot performs a number of actions in quick succession, which require a standard UI delay between them. For this, I use…
Maarx
  • 633
  • 1
  • 7
  • 18
4
votes
1 answer

Java use mouseMove with multiple monitors

I am trying to move the cursor around a computer with multiple monitors. However, when I use just the mouseMove function from robot it won't function properly. After some research I found this stackoverflow post and it almost works. But now it seems…
Aronnn
  • 63
  • 1
  • 6
4
votes
1 answer

Is there any way to run java awt application on macos without taking focus

I have simple java application main(){ Robot robot = new Robot(); Thread.sleep(5000); } It grabs focus from my other java application when i run it on macosx. Can i prevent it? It is also possible to paste Toolkit.getDefaultTookit instead of Robot…
Andrei N
  • 4,716
  • 4
  • 29
  • 29
4
votes
4 answers

AWT Robot not able to drag a window

I'm trying to move a Windows Explorer window using the AWT Robot. The robot is running in Java 7, and the OS is Windows 7. I'm able to move the mouse and click on things, but when I try to click-and-drag, it doesn't seem to be pressing the button…
Nathaniel Waisbrot
  • 23,261
  • 7
  • 71
  • 99
4
votes
3 answers

Using Java Robots class to locate things on a screen

I was wondering if it was possible to locate files or programs with this class. I know that there are ways to use mouse coordinates or simple find an application and run it but that's not what I want to do. And example to be more clear is: Let's say…
Michael Libman
  • 73
  • 1
  • 10
4
votes
2 answers

I want to use Robot class in java applet for web browser to move and click mouse

I have created this applet, It moves mouse to 1000 pos on screen. It works as application but it does not work in applet. I have created signed applet but still it wont move mouse. What should I do to make my Robot class work from browser? My code…
Sydney
  • 295
  • 1
  • 4
  • 9
4
votes
1 answer

Simulate Print Screen under Windows

I know we can simulate the print screen with the following code: robot.keyPress(KeyEvent.VK_PRINTSCREEN); ..but then how to return some BufferedImage? I found on Google some method called getClipboard() but Netbeans return me some error on this…
user1638875
  • 105
  • 3
  • 10
4
votes
3 answers

Java Robot Class - Add focus to a specific running Application?

I am just trying to figure out if/how to get the Java Robot class to change focus from the running java app, to a specific process, such as ms word or firefox. Thanks!
Johnrad
  • 2,637
  • 18
  • 58
  • 98
4
votes
1 answer

Java: use Robot while running fullscreen app

I have a problem with Robot class in Java: it sometimes doesn't work when i run a fullscreen game. Here's my code: Toolkit tlkt = Toolkit.getDefaultToolkit(); Robot bot = new Robot(); while(true) { Thread.sleep(3000); tlkt.beep(); //make…
kajacx
  • 12,361
  • 5
  • 43
  • 70
4
votes
1 answer

Capture key stroke from separate process in Java

I want this to happen: Start my java program My java program launches notepad.exe If I type a letter in notepad my java program should react and print out the letter In short: Is it possible to make a key event listener for another process?…
user1405714
  • 41
  • 1
  • 3
4
votes
1 answer

How to simulate Ctrl + Shift + f1 in swing application and write to log file

I have this swing client-server app. I want to simulate the 'Ctrl+Shift+f1' effect programatically and write to my log4j log file for certain frames that I am loading for debugging purposes. Is there a swing method I call to turn this option on? How…
sachinrahulsourav
  • 742
  • 1
  • 7
  • 16