.lmk — GUI Automation | LMX

LMX // .LMK

.lmkGUI Automation

Controls mouse/keyboard via robotjs (native desktop only).

  • Operator only
  • a .lmk file
  • free to run
WHAT IT IS

Why .lmk exists.

Scripts mouse and keyboard actions through robotjs. Meaningless (and inert) on a headless server; kept for desktop/edge deployments. Admin-only, requires LMX_ENABLE_GUI=1 and the optional robotjs dependency.

Operator only

This one touches the host machine, so it needs an operator: an admin role AND an explicit environment flag, both off by default. That is a security control, not a paywall.

Enabled with LMX_ENABLE_GUI=1 on the API, by an operator, on purpose.


A WORKED EXAMPLE

Keyboard and Mouse Demo Script

The same script the engine test suite runs, so it cannot quietly stop working.

# Keyboard and Mouse Demo Script
TITLE "GUI Automation Demo"

# Requires a real desktop + the native robotjs dependency (admin-only). Delays kept short so it
# finishes within the run limit.
WARN "This script controls your mouse and keyboard on a real desktop."
DELAY 300

# Get screen dimensions and move the mouse to the centre
GET_SCREEN_SIZE W, H
VAR CENTER_X = ${W} / 2
VAR CENTER_Y = ${H} / 2
MOUSE_MOVE ${CENTER_X}, ${CENTER_Y}
DELAY 200

# Draw a small square with the mouse
WARN "Drawing a square..."
MOUSE_DOWN
MOUSE_MOVE_REL 150, 0
DELAY 100
MOUSE_MOVE_REL 0, 150
DELAY 100
MOUSE_MOVE_REL -150, 0
DELAY 100
MOUSE_MOVE_REL 0, -150
DELAY 100
MOUSE_UP

# Click, type a message, then select-all
MOUSE_CLICK
DELAY 200
TYPE "Hello from the lmk interpreter!"
DELAY 200
KEY_TAP a, control

WARN "Demo finished!"

SYNTAX

The shape of it.

Straight from the interpreter catalogue — the same summary the editor shows as a placeholder.

TITLE "GUI demo"
GET_SCREEN_SIZE W, H
MOUSE_MOVE ${W} / 2, ${H} / 2
MOUSE_CLICK

NEXT

Where to take it.