Skip to main content

mapper.keystroke()

mapper.keystroke(param_table)

This function creates a Keystroke object for keybord emulation.
Keystroke object represents

Parameters

ParameterTypeDescription
param_tabletableThis parameter is in associative array table format, meaning it's specified by keys rather than parameter positions. See the Parameters Table section.

Parameters Table

KeyTypeDescription
codestableSpecifies an array table of virtual-key names representing the sequence of key inputs to emulate.
This parameter is required.
modifierstableSpecifies the keys to be modified when generating the key input sequence specified by the codes parameter. This is done using an array table of virtual-key names representing the modifier keys*.
durationnumberSpecifies the time in milliseconds to hold the key down before releasing it.
The default is 50.
intervalnumberSpecifies the time in milliseconds to wait after releasing one key before pressing the next key in the sequence.
The default is 0.
*

The virtual-keys that can be specified as modifier keys are as follows.

  • 'VK_SHIFT'
  • 'VK_LSHIFT'
  • 'VK_RSHIFT'
  • 'VK_CONTROL'
  • 'VK_LCONTROL'
  • 'VK_RCONTROL'
  • 'VK_MENU'
  • 'VK_LMENU'
  • 'VK_RMENU'
  • 'VK_LWIN'
  • 'VK_RWIN'
tip

When specifying virtual-key names, you can omit the VK_ prefix. The following two Keystroke objects generate the same key input sequence.

local keys1 = mapper.Keystroke{codes = {'VK_UP', 'VK_RIGHT'}}
local keys2 = mapper.Keystroke{codes = {'UP', 'RIGHT'}}

Return Values

This function returns Keystroke object.

See Also