Skip to content

Keyboard Actions

Keyboard Actions are actions to emulate an keyboard entry.

Keyboard Keys

Marvin is prepared to deal with function keys on your keyboard. For it you can give the key name, on any key event, as example:

  • keyboard.press('enter') emulate ENTER key press
  • keyboard.press('tab') emulate TAB key press
  • keyboard.press('shift') emulate SHIFT key press
  • keyboard.press('ctrl') emulate CONTROL key press
  • keyboard.press('alt') emulate ALT key press
  • keyboard.press('esc') emulate ESC key press
  • keyboard.press('return') emulate RETURN key press
  • keyboard.press('capslock') emulate CAPS LOCK key press
  • keyboard.press('up') emulate UP ARROW key press
  • keyboard.press('down') emulate DOWN ARROW key press
  • keyboard.press('left') emulate LEFT ARROW key press
  • keyboard.press('right') emulate RIGHT ARROW key press
  • keyboard.press('home') emulate HOME key press
  • keyboard.press('end') emulate END key press
  • keyboard.press('pagedown') emulate PAGE DOWN key press
  • keyboard.press('pageup') emulate PAGE UP key press

The same could be done with keyboard.key_up and keyboard.key_down actions.

Actions

keyboard.hotkey

Send a hot key combination.

Parameters:

hotkey - hot key code as string: "ctrl+c" and "ctrl+v", for example.

Returns:

This action gives no return

keyboard.key_down

Emulate the key down event on keyboard. This emulate the press and hold of a key.

Parameters:

key - key to send key down event.

Returns:

This action gives no return

keyboard.key_up

Emulate the key up event on keyboard. This emulate a release of a key.

Parameters:

key - key to send key up event.

Returns:

This action gives no return

keyboard.press

Emulate a key press event on keyboard. The key press is a key down and key up event in sequence.

Parameters:

key - key to send key press event.

Returns:

This action gives no return

keyboard.type_text

Type the given text to screen, emulating a sequence of key press.

Parameters:

text - text to type

interval - interval in seconds between each key press (default=0)

On slow machines it shold be bigger than 0, to avoid fast typing problems.

Returns:

This action gives no return