Nodes/ComfyUI Text-Driven Workflows/Prompt Line (Text-Driven)
ComfyUI Node

Prompt Line (Text-Driven)

Turn a text file into a batch queue — one prompt per line, N images per run

By kanryu·Created 4 months ago·Updated 3 months ago· 0
Prompt Line (Text-Driven)
    • string_out
    prompt
    start_index0
    max_rows1000
    remove_empty_linestrue
    loopsfalse

    Prompt Line (Text-Driven) is the node this pack's batch magic hangs on. You give it a multi-line block of prompts and it hands you a list of them - and when a KSampler receives multiple text conditionings, ComfyUI generates one image per prompt without you ever touching the latent batch size. The README calls it "batch size = 1 but 2 images," and it's a genuinely neat trick: paste ten scenario prompts into one box, get ten images from a single queue run.

    How it works

    The prompt input is a multiline text box where each line is one prompt. From there you control extraction with three settings:

    • start_index (int, default 0) - which line to begin at.
    • max_rows (int, default 1000) - how many lines to output. Set this to 2 or more and the node emits multiple prompts as a list, which is what triggers the multi-image batch.
    • loops (boolean, default off) - when on, it wraps around to the top of the list once it runs out of lines, so max_rows can exceed the number of lines in your box and it just cycles.

    remove_empty_lines (default on) strips blank/whitespace-only lines so a stray double-return doesn't inject an empty prompt into your batch.

    The output is string_out, and - this is the important part - it's a list output, not a single string. That's the difference between feeding one prompt and feeding a queue. The node also marks itself visually: it's the dark-green one in the pack (#225522/#33aa33), so it's easy to spot in a busy graph.

    The classic setup pairs it with the rest of the pack: Prompt Line supplies the variable "staging" lines, a character prompt stays fixed elsewhere, and Join Strings glues them together before the CLIP encoder. To automate the sequencing, drive start_index from a number node configured with control after generate: increment - each queue run walks one row deeper through your list, hands-free matrix collection without any scripting.

    Gotchas

    If loops is off and start_index points past the end of the list, the node clamps to the last line rather than erroring - you'll get one prompt, possibly not the one you meant, so a stale index can quietly produce "wrong" output instead of nothing. And if the prompt box is empty the node returns an empty list, which downstream CLIP encode will not thank you for.

    Install

    It ships in ComfyUI Text-Driven Workflows. ComfyUI Manager → search "ComfyUI Text-Driven Workflows" → Install, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kanryu/ComfyUI-Text-Driven-Workflows.git
    

    Restart. No pip dependencies, no model files - the pack is pure text/int logic. The one requirement is a recent ComfyUI: everything in this pack uses the V3 extension API, so on an older install it won't load at all (look for "Failed to load nodes" in the console). Update ComfyUI, restart, done.

    Bottom line

    If you batch a lot of prompts, this is the node that turns a plain text box into a queue. It's simple enough to understand in a minute, and the auto-increment + list-output combination is the thing that makes the pack's "25 scenario combinations in one run" workflow actually work. That's a real feature, not a gimmick.

    CategoryText-Driven Workflows

    Inputs (5)

    NameTypeDefaultDescription
    promptSTRING
    start_indexINT00–9999
    max_rowsINT10001–9999
    remove_empty_linesBOOLEANtrue
    loopsBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    string_outSTRING