Skip to main content

Module macros

Module macros 

Source
Expand description

GridCraft macros: typed, declarative command lists that run as one undo step. They are not VBA: a VBA project in a file is carried through unchanged (Workbook::vba_project) and never run.

Structs§

Macro
A recorded or hand-made macro: a list of typed steps that runs as one undo step. Most steps run a GridCraft command; Repeat, If and Stop add bounded control flow. References in step parameters can be tokens ("Input.col(2)") that are resolved against the declared inputs when the macro runs, so a macro recorded on one block of data works on another.
Macros
The macros of a workbook. Workbook snapshots share the list until one of them changes it, so an undo entry or a copy made for a cell edit holds the same list rather than a copy of every step. Reads go through Deref to the list; a write through DerefMut first copies the list when another snapshot shares it.
NamedInput
A range the macro works on, with the shape and content it expects.
OutputRule
Where a macro’s results go.
Step
One macro step and its editor flags.

Enums§

ColType
What a column of an input must hold. Empty cells pass unless the input is non_empty.
CompareOp
InputKind
OnConflict
RepeatOf
StepKind

Constants§

MACRO_VERSION
The macro format version written by this build.
MAX_MACROS
The most macros a workbook keeps.
MAX_MACRO_COLUMNS
The most column types an input lists: one per column of a sheet.
MAX_MACRO_DEPTH
How deeply Repeat and If may nest (a top-level step is at depth 1).
MAX_MACRO_NAME
The longest macro or input name, in characters.
MAX_MACRO_PERMISSIONS
The most commands a macro’s permissions list.
MAX_MACRO_REF
The longest reference or token in a macro (an output anchor, an input’s default range, a Repeat’s range, an If’s cell), in characters.
MAX_MACRO_SHORTCUT
The longest shortcut text (Ctrl+Shift+M), in characters.
MAX_MACRO_STEPS
The most steps in one macro, counting the steps inside Repeat and If.
MAX_MACRO_TEXT
The longest macro description, step note, Stop message or If value (as JSON), in characters.

Functions§

check_version
Refuses a format version newer than MACRO_VERSION: this build would drop the fields it doesn’t know, and a save would then write the rest back as if it were the whole macro.