We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'd like to experiment with this Java class, but on searching for 'java.awt' and awt.Robot on my HD (Jre 7.45 installed,) I get 'no items match this search'.
Aside from adding the text in the title into my code, is there another step(s) missing in the process of importing the robot class into processing? Where is jave.awt.Robot? Do I need to update Java?
Thanks
Answers
Install Java JDK, not JRE. Look for "src.zip" in the installed folder for all source code.
Ahh! Will do. For 64 bit win7 I need jdk x64, yes?
http://www.Oracle.com/technetwork/java/javase/downloads/index.html
http://docs.Oracle.com/javase/8/docs/api/index.html
The answer of GoToLoop is a bit ambiguous.
The Robot class is in the JRE as well. But you won't find it the way you search it (I think, I am not sure what you are doing, actually!).
Here, GoToLoop's advice is to get the source code of Java to locate the class.
More concrete answers:
import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; import java.io.IOException;
public class RobotSample {
public static void main(String[] args) throws IOException {
try { Robot robot = new Robot(); Runtime runtime = Runtime.getRuntime(); runtime.exec("D:\Program Files\Mozilla Firefox\firefox.exe"); robot.delay(1000); robot.keyPress(KeyEvent.VK_F6); robot.keyPress(KeyEvent.VK_DELETE); robot.keyPress(KeyEvent.VK_T); robot.keyPress(KeyEvent.VK_W); robot.keyPress(KeyEvent.VK_I); robot.keyPress(KeyEvent.VK_T); robot.delay(70); robot.keyPress(KeyEvent.VK_T); robot.keyPress(KeyEvent.VK_E); robot.keyPress(KeyEvent.VK_R); robot.keyPress(KeyEvent.VK_DECIMAL); robot.keyPress(KeyEvent.VK_C); robot.keyPress(KeyEvent.VK_O); robot.keyPress(KeyEvent.VK_M); robot.keyPress(KeyEvent.VK_ENTER); robot.delay(200); } catch (AWTException e) { e.printStackTrace(); } } }
Thanks PhiLho. designbyrj- I have no idea what your code does!