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.
| Key | Value |
|---|---|
| Enter | KEY_enter |
| Escape | KEY_esc |
| Backspace | KEY_backspace |
| Tab | KEY_tab |
| Space | KEY_space |
| Delete | KEY_delete |
| Insert | KEY_insert |
| Home / End | KEY_home / KEY_end |
| Page Up / Down | KEY_pageup / KEY_pagedown |
| Arrows | KEY_up / KEY_down / KEY_left / KEY_right |
| Caps Lock | KEY_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.
| Action | Value |
|---|---|
| Volume up / down | MEDIA_volup / MEDIA_voldown |
| Mute | MEDIA_mute |
| Play/Pause | MEDIA_playpause |
| Next / Prev | MEDIA_nexttrack / MEDIA_prevtrack |
| Stop | MEDIA_stop |
| Browser Home/Back/Search/Stop | MEDIA_www_home / MEDIA_www_back / MEDIA_www_search / MEDIA_www_stop |
| Bookmarks | MEDIA_www_bookmarks |
| Calculator | MEDIA_calculator |
| Email reader | MEDIA_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
keywordswith 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.