Nodes/AntiMatter Nodes/LinePrompt_MasterLoad
ComfyUI Node

LinePrompt_MasterLoad

A prompt cycler that reads your txt files

By AntiMatterComfy·Created 3 months ago·Updated 27 days ago· 0
LinePrompt_MasterLoad
    • text
    enabledtrue
    input_text
    text_file
    style_filenone
    lines_to_take1
    read_modesequential
    freeze_iterations0
    delimiter,
    nav0

    Batch runs die on the prompt side, not the sampler side. You want to generate a dozen variations, each with a different prompt, and the built-in tools want you to edit a widget between queues. LinePrompt_MasterLoad fixes that the old-school way: it reads a .txt file one line at a time, hands you line 1, then line 2, then line 3 - and it keeps counting internally across queue runs, so you can fire off a batch and come back to a folder full of distinct generations. If you've used A1111's prompt cycling or any wildcard tool, this is the same idea with the source of truth being a plain text file.

    How it works

    The node reads text_file (or a style_file picked from a dropdown), strips blank lines, and skips comment lines starting with # or // - a nice touch, since a prompt file is way more readable with section headers that don't end up in your images. It tracks its position in memory per node instance, keyed to the file, and every queue run moves to the next line.

    Modes: sequential, random, and from_end (reads the file backwards - think "most recent first" for an append-only prompt log). lines_to_take pulls 1–3 consecutive lines and joins them, for chaining a subject line and a style line. freeze_iterations holds the current line for N runs when you want several seeds on the same prompt. The delimiter (,, /, ., ;) gets appended to the output if it isn't already there, so the result slots cleanly into a larger prompt.

    The input_text field acts as a prefix - the output is input_text, selected_line - which is how you keep a fixed base prompt while only the tail varies.

    There's a frontend side too: the pack ships a small web extension that adds Previous / Next buttons to the node (backed by a hidden nav counter widget), so you can step through prompts manually without touching files. The style_file dropdown is populated from a folder you set in ComfyUI's settings under "LinePrompt_MasterLoad styles txt folder" - it scans that folder recursively, so you can keep a whole directory of prompt files and switch between them from the dropdown.

    Inputs that matter

    text_file (or style_file), read_mode, freeze_iterations, and input_text are the four you'll touch. enabled is the kill switch - flip it off and the node returns an empty string, which is a clean way to bypass the whole branch.

    Outputs

    One output: text, a plain STRING. Straight into a CLIPTextEncode. The node also shows the current line and a N/total status in its preview so you know where the cycle is.

    Installing it

    It's part of AntiMatter Nodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AntiMatterComfy/antimatter-nodes.git
    

    Restart ComfyUI, then set the styles folder in Settings if you want the dropdown. No extra Python dependencies, no model downloads.

    Troubleshooting

    The preview doubles as the error channel: a missing file shows file_not_found: <path> right there in the node rather than a cryptic console trace. If the dropdown is empty, you haven't set the styles folder setting yet - until you do, text_file with a full path is the fallback. One gotcha worth knowing: because the node must advance on every run, it forces re-execution each queue (IS_CHANGED returns NaN), so it will never sit on a cached result - which is exactly what you want, but it means the node always runs even in a "nothing changed" queue.

    CategoryAntiMatter/Text

    Inputs (9)

    NameTypeDefaultDescription
    enabledBOOLEANtrue
    input_textSTRING
    text_fileSTRING
    style_fileCOMBOnone1 options: none
    lines_to_takeINT11–3
    read_modeCOMBOsequential3 options: sequential, random, from_end
    freeze_iterationsINT00–100000
    delimiterCOMBO,4 options: ,, /, ., ;
    navINT0-2147483648–2147483647

    Outputs (1)

    NameTypeDescription
    textSTRING