Docs

RunMacro Documentation

Learn RunMacro from basics to advanced.

Everything you need to start and master RunMacro — from basic commands to advanced automation workflows.

RunMacro robot
Docs File Write Text File
💾 File

Write text to a file in RunMacro

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

Prerequisites

  • Write permission at the destination.

Supported modes

  • Desktop ModeOperates on the local file system.
  • Browser Mode

What it does

The Write Text File command writes your content (with optional variables) to a file. Choose overwrite or create-new (errors if it exists), set the encoding, and auto-create parent folders. Overwrite uses a safe write (temp file then atomic replace).

When to use it

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

When not to use it

  • You want to append lines to a log — use Append to Text File or Log Message.

Configuration steps

  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.

Every option explained

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).

Expected result

The file holds the written content; the output variable holds the file path.

Real example

Example: export a result to a file

  1. Write Text File: path out/result.txt, content Result: {result}, mode = overwrite, enable Create parent.

Limitations and failure cases

  • Create-new mode errors if the file already exists.

Tips & common mistakes

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.

Verification details

  • commands/filesystem.py
RunMacro robot

Ready to automate smarter?

Download RunMacro and start automating your desktop, browser, and business workflows today.