Skip to main content
A macro is a list of actions, each with a delay in milliseconds before it. rb.macro plays that list on the output with its timing kept, records the user’s input into one, and turns a take into the text of a macro file. A script reaches for it when a fixed sequence of keys, clicks and moves has to repeat with the same timing every time. This script plays a short combo on F6 and stops it on F7:

Playback

options.speed divides every delay (default 1.0; 2.0 is twice as fast). options.mode is "parallel" (default), which plays alongside the script’s other macros, or "replace", which stops them first. Timing is kept on an absolute timeline, so a late step does not delay the steps after it. Keys and buttons a macro still holds when it ends or stops are released. The MacroHandle pauses, resumes, stops, reports progress, and waits. In hardware mode, on Link firmware that plays macros, rb.macro.play plays on the Link’s clock when no other macro of the script is playing (always with "replace"), and falls back to host playback otherwise. It also plays on the host when the macro has "type" actions, media keys or controller buttons, or a value outside the streaming ranges.

Streaming

rb.macro.stream plays only on the Link. It replaces the script’s earlier streamed macro and raises instead of falling back to the host:
  • rb.macro.stream: the Link cannot play type actions; use rb.macro.play (or media keys, or controller buttons)
  • rb.macro.stream: needs Rebind Link in hardware mode, on firmware that plays macros
  • rb.macro.stream: the Link is playing another macro
  • rb.macro.stream: a delay, hold, move or scroll is not a finite number within range
rb.macro.abort raises rb.macro.abort: no device connected when the script has no output.

Recording

rb.macro.record takes { ignore_mouse = false, ignore_keyboard = false, precision = "normal" }. Calling it again restarts the script’s own take. It raises Macro.Record: another recording is running while the app’s recorder or another script records. rb.macro.finish appends a release for every key and button still held at the end, releases them on the output, and returns the take; it returns an empty table when the script is not recording.

Macro files

rb.macro.to_script returns the format the app’s recorder saves: a modeline with macro=true and permissions=none, then return of the actions. A long take also gets a larger memory_limit_mb. Run directly, a macro file adds Play hotkey, Playback speed and Mouse movement scale to its Options tab, then plays once and stops, or waits for its hotkey. require("macros/<name>") returns its actions and runs nothing.

Action format

delay is milliseconds before the action, fractions allowed; a negative delay counts as 0. Fractional moves carry their remainder to the next move. hold_ms and char_delay are also read as holdMs and charDelay.