Skip to main content

Module recorder

Module recorder 

Source
Expand description

Turning a recording into a macro.

The recording buffer (crate::engine::record) holds the top-level commands run while recording, each with the sheet and selection it ran in. When recording stops:

  • commands a macro may not run (saving, opening files…) and other macros’ commands are left out; a macro run while recording is replaced by its steps when it has no inputs, no output and only plain commands (otherwise it is left out), and an Automate script run while recording by the steps it ran, leaving out the steps a macro may not run; both are the steps as they ran, kept with the recording (crate::engine::record::Recorder::ran), and a run without them is left out;
  • a sheet.activate or selection.set step is added where the sheet or selection changed between commands without one, and runs of selection.set collapse to the last;
  • with relative references (the default), the selection when recording started is the example input: references on its sheet in, next to or near it become tokens (Input.col(2), Input.below, Input.cell(1,4)), also inside formulas ({{Input.col(2)}}), and the input’s shape, header and column types are inferred from it as it was when recording started;
  • recorded text that playback would read as a token stays text: a reference parameter that reads as one (a defined name called Output) becomes {"$text": …}, and {{ in a string becomes {{{{.

Structs§

Converted
A recording turned into a macro, with what was left out.
RecordingStart
Where recording started, kept beside the buffer, with the name, shortcut and description the macro is to be saved with (from the Record Macro dialog), applied when recording stops.

Functions§

convert
Builds a macro called name from the recorded steps. ran is what a macro or script run ran, by step index (crate::engine::record::Recorder::ran); a run without an entry is left out and listed in skipped.
infer_input
The example input’s shape: a header when the first row is all text over other kinds of values, and each column’s type when all its values agree.
inline_steps
The steps a recording keeps for a run of m: its enabled command steps as written, when they stand on their own (no inputs, no output and only plain commands; a Repeat, If or Stop means nothing outside its macro). None when they don’t, and the recording leaves the run out.