DocsFileWrite Text File

Write text to a file in RunMacro

Desktop ModeBrowser ModeRunMacro 3.5+

Write Text File writes content (with variables) to a file, choosing overwrite or create-new, encoding, and auto-create parents.

Dialog & quick setup

RunMacro Write Text File command configuration dialog showing parameter fields
Configuration dialog and parameter fields for the Write Text File command in RunMacro.
  1. Add a File › Write Text File command.
  2. Enter the file path and the content (variables allowed).
  3. Choose the mode: overwrite or create-new.
  4. (Optional) Set the encoding and enable create parent folders. Save.

Options reference

File path

The file to write (default output.txt). Supports variables.

Text

The text to write. Insert variables with {name}.

Mode

overwrite (replace existing) or create_new (error if the file exists).

Encoding

Default utf-8.

Create parent

If on, creates missing parent folders before writing.

Output variable

Variable that receives the written path (default last_written_path).

Modes & when to use

Desktop Mode

Operates on the local file system.

Browser Mode

Best for

  • Export a processing result to a file.
  • Save content composed from variables.
  • Generate a config/script file from a template.

Use an alternative when

  • You want to append lines to a log — use Append to Text File or Log Message.
Before you run
  • The file path is resolved and the parent exists or Create parent is enabled.
  • The process can create or overwrite the file under the selected mode.

Example workflow

Example: export a result to a file

  1. Write Text File: path out/result.txt, content Result: {result}, mode = overwrite, enable Create parent.
Expected result: The file holds the written content; the output variable holds the file path.

Tips & limitations

Overwrite replaces the old content. Use "create-new" if you must not clobber an existing file.
To append to the end of a file instead of overwriting, use the Append to Text File command.
  • Create-new mode errors if the file already exists.

Applies to RunMacro 3.5+ · Desktop Mode & Browser Mode · Windows 10/11

RunMacro robot

Robots do the work. Your time is yours.

Create a robot in minutes, no coding needed. Reliable execution, remote management, transparent costs — and you always stay in control.