Keyboard
February 26, 2015 · View on GitHub
keyboard
The keyboard library provides actions for simulating key strokes and sending text. Refer to the keys list.
local kb = require("keyboard");
keyboard.press( key, [...] )
Performs one or more consecutive key presses.
kb.press("down", "down", "return");
kb.press("return");
keyboard.stroke( key, [...] )
Performs a key stroke using one or more keys.
kb.stroke("ctrl", "shift", "return");
kb.stroke("win");
keyboard.text( text )
Types the specified text, including unicode and special characters.
kb.text("hello world!");
kb.text("åäö");
keyboard.down( key, [...] )
Presses one or more consequtive keys until up is called.
kb.down("return");
keyboard.up( key, [...] )
Releases one or more consequtive keys that have been pressed.
kb.up("return");
keyboard.character( chr )
Types the specified character code (UTF8 integer character code).
kb.character(0x123);
keyboard.ismodifier( key )
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
keyboard.iskey( key )
Returns a bool specifying whether or not the key is a valid key name.
print(kb.modifier("f1")); -- true
print(kb.modifier("$")); -- false