org.sikuli.api.robot
Interface Keyboard

All Known Implementing Classes:
DesktopKeyboard

public interface Keyboard

Keyboard interface provides definitions for generating native keyboard events.


Method Summary
 String copy()
          Clears the clipboard, performs the "copy" keyboard shortcut, then attempts to return the clipboard contents as a String.
 void copyRegion(ScreenRegion screenRegion)
          Copies the content of a screen region into the clipboard.
 void keyDown(int keycode)
          Presses down the key (given by the key code) on the underlying device.
 void keyDown(String keys)
          Presses down a series of keys specified by the String argument keys.
 void keyUp()
          Releases all the held down keys.
 void keyUp(int keycode)
          Releases the key (given by the key code) on the underlying device.
 void keyUp(String keys)
          Releases a series of keys specified by the String argument keys.
 void paste(String text)
          Gets plain text from the clipboard and performs the "paste" keyboard shortcut.
 void type(String text)
          Performs keyboard typing of the text specified by the arguments of the same name.
 

Method Detail

copy

String copy()
Clears the clipboard, performs the "copy" keyboard shortcut, then attempts to return the clipboard contents as a String. Returns null if the clipboard couldn't be converted to a string or was empty.

Returns:
The clipboard contents converted to a String or null

copyRegion

void copyRegion(ScreenRegion screenRegion)
Copies the content of a screen region into the clipboard. It highlights the content of the given screen region by clicking on its upper-left corner and moving the mouse to the lower-right corner, then it performs the keyboard shortcut to copy the content of the screen region.

Parameters:
screenRegion - The screen region to be copied

paste

void paste(String text)
Gets plain text from the clipboard and performs the "paste" keyboard shortcut.

Parameters:
text - the text to paste

type

void type(String text)
Performs keyboard typing of the text specified by the arguments of the same name. It presses and releases the given keys.

Parameters:
text - the keys to type

keyDown

void keyDown(int keycode)
Presses down the key (given by the key code) on the underlying device. The code depends on the type of the device. The keys should be released using the keyUp(int) method.

Parameters:
keycode - Key to press down (e.g. KeyEvent.VK_A)

keyUp

void keyUp(int keycode)
Releases the key (given by the key code) on the underlying device. The code depend on the type of the device.

Parameters:
keycode - Key to release

keyDown

void keyDown(String keys)
Presses down a series of keys specified by the String argument keys. The keys should be released using the keyUp(String) method.

Parameters:
keys - the keys to be typed down.

keyUp

void keyUp()
Releases all the held down keys.


keyUp

void keyUp(String keys)
Releases a series of keys specified by the String argument keys. The keys depend on the type of the device.

Parameters:
keys - the keys to release.


Copyright © 2014. All rights reserved.