public class SendKeys
extends java.lang.Object
Only the key names found at KeyEvent by using what comes after the "VK_". The following VB names have been crossed referenced to the VK_ names as well.
BACKSPACE BACK_SPACE
BKSP BACK_SPACE
BS BACK_SPACE
CAPSLOCK CAPS_LOCK
CTRL CONTROL
DEL DELETE
INS INSERT
PGDN PAGE_DOWN
PGUP PAGE_UP
WINKEY WINDOWS
Example:
1. Set the default delay.
2. Run Notepad, wait for it to run.
3. Enter some text.
4. Open the about dialog.
{DELAY=50}{WINDOWS}rnotepad{ENTER}{DELAY 1000}hello world{ALT}ha
| Modifier and Type | Class and Description |
|---|---|
static class |
SendKeys.Driver |
| Modifier and Type | Method and Description |
|---|---|
static void |
delay(int ms)
Delays for the specified number of milliseconds.
|
static int |
getDelay()
Returns the current default delay in milliseconds.
|
static java.lang.String |
sendKeys(java.lang.String keystrokes)
This method parses the string and sends the keys.
|
static void |
setDelay(int ms)
Sets the default delay.
|
static void |
setDriver(SendKeys.Driver driver)
Sets the driver that sendkeys should use.
|
static void |
setWindowName(java.lang.String name) |
public static int getDelay()
public static void setDelay(int ms)
ms - The number of milliseconds.public static void setDriver(SendKeys.Driver driver)
driver - The type of driver to use, AWT or WINDOWSpublic static void delay(int ms)
ms - The number of milliseconds.public static void setWindowName(java.lang.String name)
public static java.lang.String sendKeys(java.lang.String keystrokes)
keystrokes - The keystrokes to send.