Skip to content

ZeroTrace HID

Blocks

Group and repeat lines — write blocks, repeat, while, functions, and comment blocks

Blocks group several lines under a single start/end pair. Text blocks type each enclosed line; control blocks repeat, loop, define, or skip the lines between their markers.

How blocks are written

Every block is opened with a …Start command and closed with the matching …End command on its own line. Text-block lines between the markers are typed as raw text (including any # or //), while repeat, while, and function bodies are re-parsed as commands.

Text blocks

Instead of one write command per line, a text block types every line between its markers. Each variant matches the corresponding single-line keyboard command.

writeStart … writeEnd types each line; writeLnStart … writeLnEnd presses Enter after each line. A small inter-line gap lets the host keep up — the default is 12 ms. Pass an optional gap on the start marker to raise it (e.g. writeLnStart 30).

writeLnStart
First line
Second line
writeLnEnd
writeLnStart 30
Paced line one
Paced line two
writeLnEnd

Repeat

repeatStart <n> … repeatEnd runs the enclosed commands n times. The count is a signed integer (max 2147483647). A stop request breaks out of the loop.

repeatStart 3
writeLn "Repeat me"
write "and me"
repeatEnd

While

whileStart "<a>" <op> "<b>" … whileEnd repeats the body while the condition holds. The condition uses the same quoted-operand syntax as IF and is re-expanded and re-evaluated every iteration, so it usually references a variable you mutate inside the loop. A runaway guard caps the loop at 100,000 iterations.

_$VAR counter = "0"
whileStart "${counter}$" < "5"
writeLn "Attempt ${counter}$"
add counter 1
whileEnd

Function

functionStart <name> … functionEnd defines a reusable named block. The body is stored, not executed, at definition time; invoke it later with call <name> or <name>(). Functions must be defined before they are called, and recursion is bounded to a call depth of 16.

functionStart greet
writeLn "Hello from a function"
functionEnd

call greet
greet()

Comment block

Everything between commentStart and commentEnd is skipped while the script is read. Unlike single-line // and # comments, a comment block also works inside repeat, while, and function bodies.

commentStart
This whole section is ignored,
including any commands inside it.
commentEnd

Block reference

BlockStartEndBehavior
WritewriteStart [gap]writeEndTypes each line (default gap 12 ms)
WriteLnwriteLnStart [gap]writeLnEndTypes each line + Enter (default gap 12 ms)
AccurateWriteaccurateWriteStart [ms]accurateWriteEndPer-char delay (default 40 ms), 300 ms between lines, HID only
AccurateWriteLnaccurateWriteLnStart [ms]accurateWriteLnEndAs above + Enter, HID only
DelayedWritedelayedWriteStart [ms]delayedWriteEndDriver-side per-char delay (default 40 ms), HID only
DelayedWriteLndelayedWriteLnStart [ms]delayedWriteLnEndAs above + Enter, HID only
RepeatrepeatStart <n>repeatEndRuns body n times (signed int, max 2147483647)
WhilewhileStart "<a>" <op> "<b>"whileEndLoops while condition holds (max 100,000 iters)
FunctionfunctionStart <name>functionEndDefines a callable block (recursion depth ≤ 16)
CommentcommentStartcommentEndSkips everything in between

Command Palette

Search for a command to run...