Skip to content

ZeroTrace BLELogger

Scripting & Detection Rules

Replace rules, keyword and regex detection, action types

BLELogger's "scripting" is a rule engine — define triggers, define actions, the firmware fires actions when triggers match the live input stream. No firmware compile, no flash; rules are live within ~100 ms of save.

Rule syntax

("REPLACE")["trigger"] = "action"
  • "trigger" — exact text to detect (case-sensitive substring match).
  • "action" — keyboard primitive, media primitive, or text output.

Action types

Keyboard actions

Use the KEY_ prefix.

KeyValue
EnterKEY_enter
EscapeKEY_esc
BackspaceKEY_backspace
TabKEY_tab
SpaceKEY_space
DeleteKEY_delete
InsertKEY_insert
Home / EndKEY_home / KEY_end
Page Up / DownKEY_pageup / KEY_pagedown
ArrowsKEY_up / KEY_down / KEY_left / KEY_right
Caps LockKEY_capslock

Modifiers (auto press/release): KEY_ctrl, KEY_shift, KEY_alt, KEY_gui.

Function keys: KEY_F1 through KEY_F24.

Numpad: KEY_num0 ... KEY_num9, KEY_numslash, KEY_numasterisk, KEY_numminus, KEY_numplus, KEY_numenter, KEY_numperiod.

Media actions

Use the MEDIA_ prefix.

ActionValue
Volume up / downMEDIA_volup / MEDIA_voldown
MuteMEDIA_mute
Play/PauseMEDIA_playpause
Next / PrevMEDIA_nexttrack / MEDIA_prevtrack
StopMEDIA_stop
Browser Home/Back/Search/StopMEDIA_www_home / MEDIA_www_back / MEDIA_www_search / MEDIA_www_stop
BookmarksMEDIA_www_bookmarks
CalculatorMEDIA_calculator
Email readerMEDIA_email_reader

Text output

If the action doesn't start with KEY_ or MEDIA_, it's typed as text.

("REPLACE")["brb"] = "be right back"

Prefix with !print to type then press Enter:

("REPLACE")["send"] = "!print Hello world"

Single characters work too:

("REPLACE")["dot"] = "."
("REPLACE")["slash"] = "/"

Matching behavior

  • Triggers are case-sensitive substring matches against the live stream.
  • First matching rule wins; only one rule fires per input event.
  • Modifier keys auto press and release.

Avoid triggers shorter than 2 characters (a, e) unless deliberate — they fire constantly. Use unique prefixes like zt_, /cmd, or ::.

Examples

Vim-style cursor in any app

("REPLACE")["h"] = "KEY_left"
("REPLACE")["j"] = "KEY_down"
("REPLACE")["k"] = "KEY_up"
("REPLACE")["l"] = "KEY_right"

One-key media control

("REPLACE")["pause"] = "MEDIA_playpause"
("REPLACE")["mute"] = "MEDIA_mute"

Snippet expansion

("REPLACE")["sig"] = "!print --\nName Surname\nname@example.com"
("REPLACE")["addr"] = "Hauptstr. 1, 12345 Berlin"

Keyword & regex detection

Beyond replace rules, the Detection config supports:

keywords:
  - password
  - login
  - admin

regex:
  - ([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,})
  - (password\s*[:=]\s*\S+)

Matches surface in the Detection panel of the web UI in real time. Use them for read-only audit (no action fires) or wire to replace rules for triggered behavior.

Best practices

  • Test rules in the Live panel before committing — every match is logged.
  • Pair keywords with audit-only output to avoid silent automation surprises.
  • Keep regex patterns anchored — unanchored .* patterns drag CPU on busy keyboards.
  • Save rule sets to the on-device filesystem and version-control them off-device for engagement portability.