The keyboard library provides actions for simulating key strokes and sending text. Refer to the keys list.
local kb = require("keyboard");
Performs one or more consecutive key presses.
kb.press("down", "down", "return");
kb.press("return");
Performs a key stroke using one or more keys.
kb.stroke("ctrl", "shift", "return");
kb.stroke("win");
Types the specified text, including unicode and special characters.
kb.text("hello world!");
kb.text("åäö");
Presses one or more consequtive keys until up
is called.
kb.down("return");
Releases one or more consequtive keys that have been pressed.
kb.up("return");
Types the specified character code (UTF8 integer character code).
kb.character(0x123);
Returns a bool specifying whether or not the key is a modifier (e.g. ctrl, shift, alt).
print(kb.modifier("ctrl")); -- true
print(kb.modifier("return")); -- false
Returns a bool specifying whether or not the key is a valid key name.
print(kb.modifier("f1")); -- true
print(kb.modifier("$")); -- false