kvm

Keyword definitions for specialised functionality for Keyboard, Mouse and Video-based manipulation.

These keywords rely on PlatformVideoInput library to be initialized using the PlatformVideoInput.Init keyword. The initialization is platform-specific.

  • Type: RESOURCE

  • Scope: GLOBAL

Keywords

Click ${button} Button

Click a button on the virtual pointer.

Embedded arguments:

  • ${button}: Button to click (LEFT|RIGHT|MIDDLE).

Click ${button} Button On ${destination}

Move the virtual pointer to the destination and click the button.

See Move Pointer to ${destination} for details.

Embedded arguments:

  • ${button}: Button to click (LEFT|RIGHT|MIDDLE).
  • ${destination}: The template or location to click on.

Displace ${point} By (${x}, ${y})

Shift a point by the specified displacements along the x and y axes.

Embedded arguments:

  • ${point}: Point to be displaced, as a tuple (x, y).
  • ${x}: Displacement along the x-axis.
  • ${y}: Displacement along the y-axis.

Return: Displaced point, as a tuple (x, y) of integers.


Ensure ${destination} Does Not Match

Ensure a given template or string doesn't match within a given timeout and number of attempts. This function is intended to be used like: "This given template or image should, by the end of this time, not be found on the screen."

Embedded arguments:

  • ${destination}: The template or string to match.

This function ensures that the given destination is not found.

Positional and named arguments

Name

Type

Default Value

Kind

Required

timeout

2

POSITIONAL_OR_NAMED

No


Get Center Of ${region}

Get the center point of a region.

Embedded arguments:

  • ${region}: Rectangular region represented by a dictionary

of integer values for "left", "right", "top", and "bottom" keys.

Return: Center of the region, as a tuple (x, y) of integers.


Move Pointer To ${destination}

Move the pointer to an absolute position or image template.

Embedded arguments:

  • ${destination}: Where to move the pointer to. If ${destination}

is a tuple (x, y) of integers, the pointer will move to the absolute position given by the tuple. Otherwise, if ${destination} is the path of an image template file, the pointer will move to the center of the first matching template region. ${destination} can also be a string, and the pointer will move to the center of the found text.

Return: Absolute position of the pointer after the move, as a tuple (x, y) of integers.


Move Pointer To ${destination} In ${domain}

Move the pointer to an absolute position or image template.

Embedded arguments:

  • ${destination}: Where to move the pointer to. If ${destination}

is a tuple (x, y) of integers, the pointer will move to the absolute position given by the tuple. Otherwise, if ${destination} is the path of an image template file, the pointer will move to the center of the first matching template region. ${destination} can also be a string, and the pointer will move to the center of the found text.

  • ${domain}: Given region or template to search for ${destination} within.

Return: Absolute position of the pointer after the move, as a tuple (x, y) of integers.


Move Pointer To (${x}, ${y})

Move the pointer to an absolute position.

Embedded arguments:

  • ${x}: Integer absolute x-coordinate to move the pointer to.
  • ${y}: Integer absolute y-coordinate to move the pointer to.

Move Pointer To Proportional (${x}, ${y})

Move the pointer to a destination position given as proportions to the size of the display output.

Embedded arguments:

  • ${x}: Output-relative x-coordinate to move the pointer to.

It must be in the range 0..1, where 0 represents the left edge, and 1 represents the right edge of the output.

  • ${y}: Output-relative y-coordinate to move the pointer to.

It must be in the range 0..1, where 0 represents the top edge, and 1 represents the bottom edge of the output.

Return: Absolute position of the pointer after the move, as a tuple (x, y) of integers.


Press ${button} Button

Press a button on the virtual pointer.

Embedded arguments:

  • ${button}: Button to press (LEFT|RIGHT|MIDDLE).

Press And Wait For Match

Positional and named arguments

Name

Type

Default Value

Kind

Required

keys-combo

POSITIONAL_OR_NAMED

Yes

template

POSITIONAL_OR_NAMED

Yes

timeout

10

POSITIONAL_OR_NAMED

No

tolerance

${DEFAULT_TEMPLATE_MATCHING_TOLERANCE}

POSITIONAL_OR_NAMED

No


Press Combo And Match

If the provided template is not already matching, press a key combination until it does.

Positional and named arguments

Name

Type

Default Value

Kind

Required

keys-combo

POSITIONAL_OR_NAMED

Yes

template

POSITIONAL_OR_NAMED

Yes

tentatives

1

POSITIONAL_OR_NAMED

No

timeout

2

POSITIONAL_OR_NAMED

No

tolerance

${DEFAULT_TEMPLATE_MATCHING_TOLERANCE}

POSITIONAL_OR_NAMED

No


Press Key And Match

If the provided template is not already matching, press a key until it does.

Positional and named arguments

Name

Type

Default Value

Kind

Required

key

POSITIONAL_OR_NAMED

Yes

template

POSITIONAL_OR_NAMED

Yes

tentatives

1

POSITIONAL_OR_NAMED

No

timeout

2

POSITIONAL_OR_NAMED

No


Release ${button} Button

Release a button on the virtual pointer.

Embedded arguments:

  • ${button}: Button to release (LEFT|RIGHT|MIDDLE).

Release Buttons

Release all buttons on the virtual pointer.


Walk Pointer To ${destination}

Moves the pointer in incremental steps from the current pointer position to an absolute position or image template.

Embedded arguments:

  • ${destination}: Where to walk the pointer to. If ${destination}

is a tuple (x, y) of integers, the pointer will walk to the absolute position given by the tuple. Otherwise, if ${destination} is the path of an image template file, the pointer will walk to the center of the first matching template region.

  • ${step_distance} (optional): Size of each step, in pixels.

Default is 16.

  • ${delay} (optional): Time to sleep after each step, in seconds.

Default is 0.01.

Return: Absolute position of the pointer after the walk, as a tuple (x, y) of integers.

Positional and named arguments

Name

Type

Default Value

Kind

Required

step_distance

16

POSITIONAL_OR_NAMED

No

delay

0.01

POSITIONAL_OR_NAMED

No


Walk Pointer To (${x}, ${y})

Move the pointer in incremental steps from the current pointer position to an absolute position.

Embedded arguments:

  • ${x}: Integer absolute x-coordinate to walk the pointer to.
  • ${y}: Integer absolute y-coordinate to walk the pointer to.
  • ${step_distance} (optional): Size of each step, in pixels.

Default is 16.

  • ${delay} (optional): Time to sleep after each step, in seconds.

Default is 0.01.

Positional and named arguments

Name

Type

Default Value

Kind

Required

step_distance

16

POSITIONAL_OR_NAMED

No

delay

0.01

POSITIONAL_OR_NAMED

No


Walk Pointer To Proportional (${x}, ${y})

Move the pointer in incremental steps from the current pointer position to a destination position given as proportions to the size of the display output.

Embedded arguments:

  • ${x}: Output-relative x-coordinate to move the pointer to.

It must be in the range 0..1, where 0 represents the left edge, and 1 represents the right edge of the output.

  • ${y}: Output-relative y-coordinate to move the pointer to.

It must be in the range 0..1, where 0 represents the top edge, and 1 represents the bottom edge of the output.

  • ${step_distance} (optional): Size of each step, in pixels.

Default is 16.

  • ${delay} (optional): Time to sleep after each step, in seconds.

Default is 0.01.

Return: Absolute position of the pointer after the walk, as a tuple (x, y) of integers.

Positional and named arguments

Name

Type

Default Value

Kind

Required

step_distance

16

POSITIONAL_OR_NAMED

No

delay

0.01

POSITIONAL_OR_NAMED

No