Robot keyPress issue
in
Programming Questions
•
2 years ago
Hello all,
I'm trying to send keystrokes from my Processing code but I encounter some issues .. it works perfectly on normal applications (for example .. Notepad, browsers etc) but not on games (fullscreen or windowed mode).
This is the stripped code I'm using :
- import java.awt.Robot;
- import java.awt.AWTException;
- import java.awt.event.InputEvent;
- Robot robot;
- void setup()
- {
- try
- {
- robot = new Robot();
- }
- catch(AWTException a)
- {
- // Nothing for now :)
- }
- }
- void draw()
- {
- robot.keyPress(KeyEvent.VK_A);
- robot.keyRelease(KeyEvent.VK_A);
- delay(1000);
- }
Can you please help?
Thank you
Sorin
1