ComfyUI Node

Text Batch

Batch prompts from a box or a file

By aidec·Created 2 years ago·Updated 9 months ago· 19
Text Batch
    • prompt
    • status
    • current_index
    • total
    • completed
    input_modetext
    text_fileEnter the path to your text file here
    input_textEnter your text here...
    separator_typenewline
    separator---
    start_index0
    auto_stoptrue

    Text Batch is the beefed-up cousin of Text Queue Processor. Same core job - feed ComfyUI a list of prompts and let it run through them one generation at a time - but with two upgrades that matter once your prompt list stops being three lines in a text box: it can read from a file, and it uses a block separator so a single "prompt" can span multiple lines.

    That second part is the reason to pick this one. Plenty of good prompts are paragraphs, or have line breaks baked in. With a plain newline split, every line becomes its own generation and your carefully structured prompt gets shredded. Text Batch defaults its separator to ---, so you write each full prompt as a block and put a --- between blocks. Now a prompt can be as long and multi-line as you want.

    How it works

    Like the rest of aidec's queue nodes, it leans on a server-side counter instead of a real loop. Each time the workflow runs it emits the block at current_index, then advances. It's an output node, so it re-queues itself and marches through the whole list unattended. The difference from the plain queue processor is auto_stop - when it reaches the end it halts cleanly on its own rather than depending on something downstream to notice completed.

    The inputs that matter

    • input_mode - text to type your prompts into the node, or file to point it at a .txt on disk. File mode is the one you'll want once the list gets long or you're generating prompts elsewhere.
    • text_file - the path, when you're in file mode.
    • input_text - the multiline box, when you're in text mode.
    • separator_type / separator - newline for one-line-per-prompt, or leave it as-is with separator set to --- for multi-line blocks. This is the headline feature; use it.
    • start_index - where the walk begins (0 normally).
    • auto_stop - leave it on so the batch ends itself.

    The main output is prompt - note it's named prompt, not text like the queue processor - which you wire into CLIP Text Encode. Alongside it you get current_index, total, completed, and status. Route current_index into a filename or seed so your outputs stay traceable to the list.

    Installing it

    cd ComfyUI/custom_nodes && git clone https://github.com/aidec/Comfyui_TextBatch_aidec, then restart ComfyUI. (Or ComfyUI Manager → Install via Git URL with that repo link.) Nothing to download beyond the code itself - no models, no extra Python packages - and it shows up under the TextBatch category.

    Where people get burned

    • Separator mismatch. If your file uses blank lines between prompts but the node is set to split on ---, you'll get one giant "prompt." Match the separator to how your file is actually written - that's the single most common way this goes sideways.
    • File paths. In file mode, give it a real, absolute path the ComfyUI process can read. A relative path or a typo'd folder just yields an empty batch. On a hosted/serverless ComfyUI, "on disk" means the server's disk, not your laptop's.
    • start_index is sticky. After a full run, reset it to 0 before going again. It doesn't rewind on its own.
    • One tab at a time. The counter is shared server state across the whole ComfyUI instance, so don't run this batch alongside another queue in a second window - they'll corrupt each other's position.

    If Text Queue Processor felt too limited the moment your prompts got longer than a line, this is the one you actually wanted.

    CategoryTextBatch

    Inputs (7)

    NameTypeDefaultDescription
    input_modeCOMBOtext2 options: text, file
    text_fileSTRINGEnter the path to your text file here
    input_textSTRINGEnter your text here...
    separator_typeCOMBOnewline2 options: newline, custom
    separatorSTRING---
    start_indexINT00–10000
    auto_stopBOOLEANtrue

    Outputs (5)

    NameTypeDescription
    promptSTRING
    statusSTRING
    current_indexINT
    totalINT
    completedBOOLEAN