Below is a sample java code which does the same purpose of sendKeys in vb code.
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;
public class RobotTest{
//Create an array of keycode data
static int keyInput[] = {
KeyEvent.VK_H,
KeyEvent.VK_E,
KeyEvent.VK_L,
KeyEvent.VK_L,
KeyEvent.VK_O
};
public static void main(String[] args)throws AWTException,IOException{
Runtime.getRuntime().exec("notepad.exe");
Robot robot = new Robot();
for (int i = 0;i <>
robot.keyPress(keyInput[i]);
robot.delay(500);
}
}
}
Monday, June 22, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment