Well, this only sends lowercase text, but for what you guys are probably going to use it for (runescape) you probably won't care, because RS automatically makes things uppercase in the first place.
heres a basic application that uses it (its declared as static here because main() is a static method):
Hope I helped.
Code:
import java.awt.Robot;
public void sendkeys(String text) {
try {
Robot robot = new Robot();
String lol = text.toUpperCase();
for(int i=0;i<lol.length();i++) {
robot.keyPress(lol.charAt(i));
}
} catch(java.awt.AWTException exc) {
System.out.println("error");
}
}
heres a basic application that uses it (its declared as static here because main() is a static method):
Code:
import java.awt.Robot;
public class Sendkeys {
public static void sendkeys(String text) {
try {
Robot robot = new Robot();
String lol = text.toUpperCase();
for(int i=0;i<lol.length();i++) {
robot.keyPress(lol.charAt(i));
}
} catch(java.awt.AWTException exc) {
System.out.println("error");
}
}
public static void main(String[] args) {
try {
Runtime.getRuntime().exec("notepad");
Robot r = new Robot();
r.delay(1000);
sendkeys("Hello world!");
} catch(java.io.IOException exc) {
System.out.println("Error!");
} catch(java.awt.AWTException exc) {
System.out.println("Error!");
}
}
}
Hope I helped.

