ScarlotSoft Easy Line From File
Feed prompts from a text file, one line per run — ScarlotSoft Easy Line From File
- Line
Here's the workflow problem this solves: you have a text file of thirty prompt variations, and you want each queue run to pick the next one, automatically, with no human touching anything. ScarlotSoft Easy Line From File reads a text file from your ComfyUI input folder and hands you one line as a STRING. The trick is the toggle: bool_mode set to Auto cycles forward through the file one line per run, forever (wrapping at the end). Set to Index, and it returns the line at whatever index you specify.
The Auto mode is where the magic - and the one gotcha - lives. Behind the scenes the node keeps a per-node counter in memory and returns lines[counter % len(lines)], then increments. Because it returns a forced "changed" signal on every queue, ComfyUI is tricked into re-running even when nothing else in the graph changed. That means it advances on every queue, not every image: if your graph generates a batch of four, you get one line for the whole batch. That trips people who expect one variation per image. It also means the counter is per node instance and resets when ComfyUI restarts - fine for a session, not a source of truth.
The file path is relative to ComfyUI's input directory. You'll get the best mileage dropping prompts.txt into ComfyUI/input/ and putting prompts.txt in the file_path box. If the file doesn't exist, the node logs a red error in the console and returns an empty string rather than crashing the graph - a graceful touch. The author also added path-traversal protection here: the node resolves the path against the input directory and refuses anything that escapes it, so ../ tricks get blocked. That's a genuinely nice safety addition for a node that reads arbitrary files.
The output is a plain STRING, so wire it into any text input - a CLIPTextEncodeModular's subject, a concat node, or a text-preview node to sanity-check what's coming. The input schema is just file_path, bool_mode, and index; that's it.
Install with the rest of the suite (ComfyUI Manager → search ScarlotSoft → install → restart), or:
cd ComfyUI/custom_nodes
git clone https://github.com/scarlotsoft/ComfyUI_ScarlotSoft
No dependencies, no model downloads. Standard suite theme, hard-refresh after a UI-mode change.
Where this shines is unattended variation runs - same graph, fresh line each time, collected via the suite's Save Image. The Index mode is the one you reach for when you want a specific line pinned, or when you want a different node to choose the number. Minor complaint: there's no shuffle, no weighting, no "random line" mode, and no comma-parsing - it's strictly one non-empty line per run. That's the deal; the node is deliberately easy, and for a prompt-testing loop that's exactly what you want.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| file_path | STRING | — | |
| bool_mode | BOOLEAN | true | — |
| index | INT | 00–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Line | STRING | — |