Write to Text File
The Write to Text File action writes text to a local file on your PC when an alert fires. You can use it to build dynamic logs, update text sources read by OBS or other software, track running totals, or export event data in any format you choose.
The file's content supports full placeholder syntax, including math transforms, so you can include dynamic event values directly in the output.
Configuration
File Path
The path to the local file you want to write to. You can use the file picker button to browse for a file, or type a path directly.
Example paths:
C:\Users\YourName\Desktop\latest-tip.txt
C:\OBS\sources\donation-log.txt
If you add a Text (GDI+) source in OBS and point it to a .txt file, OBS will automatically display the file's contents on stream. Combine this with the Overwrite write mode to update what's shown in real time every time an alert fires.
Content
The text to write to the file. Supports all placeholder syntax:
{{ username }} tipped {{ value | toFixed:2 }}!
Donation received: ${{ value }} from {{ username | "Anonymous" }}
Message: {{ message | "(none)" }}
See Using Event Data in Actions for the full placeholder and math transform reference.
Write Mode
Controls how new content is added to the file.
| Mode | What it does |
|---|---|
| Overwrite | Replaces the entire file with the new content. Previous contents are lost. |
| Append | Adds the new content to the end of the file as-is, with no separator. |
| Append with New Line | Adds the new content to the end of the file, preceded by a line break (only if the file already has content). |
| Prepend | Adds the new content to the beginning of the file. |
Choosing a write mode:
- Use Overwrite when the file holds only the most recent value (e.g. an OBS text source showing the latest donation).
- Use Append with New Line to build a running log, with each event on its own line.
- Use Prepend to keep the newest entry at the top of a log file.
- Use Append when you need precise control over spacing or separators (e.g. CSV rows where you handle the comma yourself).
If File Doesn't Exist
Controls what happens when the target file does not already exist.
| Option | What it does |
|---|---|
| Fail with error | The action fails and logs an error. No file is created. |
| Create file | Creates the file automatically (along with any missing parent directories). |
If you are writing to a new file for the first time, set this to Create file.
Examples
Latest donation — OBS text source
Write mode: Overwrite
If not exists: Create file
Content: {{ username | "Anonymous" }} — ${{ value | toFixed:2 }}
Add a Text (GDI+) source in OBS pointing to this file. It will update live every time a tip comes in.
Donation log — one entry per line
Write mode: Append with New Line
If not exists: Create file
Content: {{ username }} tipped ${{ value | toFixed:2 }} — {{ message | "(no message)" }}
After several events, the file might look like:
CoolViewer42 tipped $10.00 — Keep it up!
AnonFan tipped $5.00 — (no message)
StreamSupporter tipped $25.50 — Love the content
Bits-to-dollars converter log
Write mode: Append with New Line
If not exists: Create file
Content: {{ username }} cheered {{ bits }} bits (~${{ bits | * 0.01 | toFixed:2 }})
Tips
- The file path supports environment variables on Windows (e.g.
%USERPROFILE%\Desktop\tips.txt). - If you use the Append or Prepend mode on a non-existent file with Create file enabled, the file is created and the content is written as-is with no separator.
- For large log files, TipLink reads the full file into memory before prepending. Prefer Append with New Line for high-volume streams to avoid performance overhead.