Robot

class pyjt.Robot(robot=None, typespeed=20)

Bases: object

Smart robot features for controlling the application.

Parameters:
  • robot (java.awt.Robot) – Use the given java.awt.Robot() object If robot is None, create a own instance of the robot class.

  • typespeed (int) – The speed to type text in number of keystrokes per second.

property Events
click()

Execute a click of the left mouse.

move(control)

Move the mouse pointer to the position of a control.

Parameters:

control – The control to move the mouse pointer to.

selectAll()

Emulate selecting all text in the current context by pressing CTRL-A.

type(text)

Emulate user typing the given text.

Typing is emulated by generating VK_* events. The type speed (delay between each keystroke) is configured in the Robot’s constructor’s typespeed argument.

Parameters:

text (string) – Text to type.

Note

Currently, this function assumes that a english keyboard layout is used.

typeVirtualKeys(vks)