Escribal
Back to Docs

More

Document

This group manages the documents the workflow already has open: it writes one out early, picks which one the other instructions act on, and throws one away.

Prerequisite: a document created or opened earlier in the workflow (Create … or Open …).

These concepts are explained here once.

  • Document: the Document key says which open document the instruction acts on. Left empty, it acts on the current document — the last one created or opened, or the one Set current document chose.
  • You do not need to save. When the workflow ends, every document still open is written to its destination. Save document is for saving early; Close document is for not saving.
  • Saving also closes. After Save document that key no longer names an open document, so the instructions that come after it do nothing on that key.

Close document

Closes an open document without saving it: everything done to it is discarded.

When to use it: for a document that was only a means to an end — a draft you read from and do not want to write — or to free a key.

Parameter Meaning Default Required
Document key Which open document to close. Empty = the current document (accepts @name) (empty) No

Important behavior: nothing is written, and there is no confirmation: the changes are lost on purpose. A document closed this way is not saved at the end of the workflow either. If no document is open under that key, nothing happens. Because it never saves, a document closed this way does not need a File name or a File path.


Save document

Writes an open document to its destination and closes it.

When to use it: to finish with a document before the workflow ends — for example to write a file and then open it again as the source of another one, or to free a key you want to reuse.

Parameter Meaning Default Required
Document key Which open document to save. Empty = the current document (accepts @name) (empty) No

Important behavior: the document is written to the File name and File path given when it was created or opened; if either is missing, the workflow stops here and says which document it was. If no document is open under that key, nothing happens. After saving, the key is free: the document is no longer open, and asking for it again does nothing.


Set current document

Chooses which of the open documents is the current one.

When to use it: when the workflow has more than one document open and you would rather not repeat the Document key in every instruction.

Parameter Meaning Default Required
Document key Which open document becomes the current one (accepts @name) (empty) Yes

Important behavior: if no document is open under that name, the workflow stops with an error — unlike most instructions, this one does not carry on in silence, because everything that follows would have acted on the wrong document.


Set save encoding

Chooses the character set an open document is written with.

When to use it: when the file has to be read by something that does not expect UTF-8 — an older program, a bank or government upload, a system that asks for “ANSI”. Also to add or remove the byte order mark, which some programs need and others show as three stray characters at the top of the file.

Parameter Meaning Default Required
Document key Which open document to set it on. Empty = the current document (accepts @name) (empty) No
Encoding utf-8, utf-8-bom, iso-8859-1 or windows-1252 utf-8 No

Important behavior: it applies only to plain text, Markdown, JSON and CSV/TSV documents: a .docx, .pptx, .xlsx or PDF file is not text and has no character set to choose, so the instruction does nothing and the run says so. The choice is applied when the document is saved, so it can be set at any point before that; setting it twice keeps the last one. Without this instruction every document is written as UTF-8 without the byte order mark, which is what they have always been. Characters the chosen set cannot represent — a € in iso-8859-1 — are written as ?, which is what the encoding itself does and not something the program decides.


This documentation is the help of the application, and it comes underCreative Commons Attribution 4.0.