Lua:doKeyPress

From Cheat Engine
Revision as of 23:57, 4 December 2025 by Leunsel (talk | contribs) (Added CodeBox Template.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
<> Function

function doKeyPress(Key)

Simulates a key press by sending a key down followed by a key up event for the specified key.

Function Parameters

Parameter Type Description
Key Integer or Virtual-Key Code The virtual key code of the key to press (e.g., VK_F1, VK_SHIFT).

Examples

-- Simulate pressing the Enter key
doKeyPress(VK_RETURN)

-- Simulate pressing the "A" key
doKeyPress(VK_A)

See also

Lua
Script Engine

Related Functions

getMousePos
setMousePos
isKeyPressed
keyDown
keyUp
doKeyPress
mouse_event
setGlobalKeyPollInterval
setGlobalDelayBetweenHotkeyActivation