Nodes/ComfyUI-batching-nodes/Batch Text (Prompt Loop)
ComfyUI Node

Batch Text (Prompt Loop)

One paste, one queue press, a pile of images

By Hahihula·Created 8 months ago·Updated 5 months ago· 14
Batch Text (Prompt Loop)
    • prompts_list
    • count
    textprompt 1 prompt 2 prompt 3
    delimiter
    skip_emptytrue

    If you came to ComfyUI from Automatic1111, you probably remember the sinking feeling of realizing there's no obvious "batch prompts" button. The old workaround was copying a prompt, queueing, pasting the next one, queueing again - and the community threads asking "can I even do this?" went unanswered for months. Batch Text (Prompt Loop) is the fix. You paste a list of prompts into one text box, hit queue once, and the workflow runs once per prompt. That's the entire job, and it does it without an API key, a scheduler, or a single extra Python package.

    How it works

    The node splits your text on a delimiter and hands the results back as a list. Then ComfyUI's own machinery takes over: when a list output feeds a normal input like the text box on CLIP Text Encode, ComfyUI automatically executes the downstream workflow once per list item. Three prompts in, three images out. That's why it's called a "loop" - there's no literal loop node, the list fans out for you.

    The inputs that matter

    • text (multiline) - one prompt per line by default. Paste a whole block, no fiddling.
    • delimiter - defaults to newline (\n). Change it to , or | if your list is comma- or pipe-separated, or to \n\n if a single prompt legitimately spans multiple lines.
    • skip_empty - leave this on (default). It drops blank lines and trims whitespace so a stray trailing newline doesn't give you an empty prompt.

    Outputs

    • prompts_list - the actual list of prompts. This is the one you wire into CLIP Text Encode (or anything that takes a string).
    • count - a plain integer with the number of prompts. Handy for filename numbering or metadata, and a fast sanity check that your delimiter actually split things.

    Installing it

    It ships in the tiny MIT-licensed pack ComfyUI-batching-nodes by Hahihula. Easiest path: ComfyUI Manager, search "ComfyUI Batching Nodes" (or "Batch Images"), hit install, restart. Manual install is the usual clone:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Hahihula/ComfyUI-batching-nodes
    

    Then restart ComfyUI - you'll see a Prompt Loop Node - Loading... banner in the console. There's no pip install, no model downloads, no heavy dependency beyond the torch/numpy/PIL ComfyUI already bundles. On load the pack registers PromptLoopNode and PromptFromListNode for the text side and two image nodes you'll meet in this pack's other pages.

    Where people get burned

    The classic failure is delimiter mismatch: you paste comma-separated prompts but leave the default \n, and you get one long run-on prompt instead of a batch. Check count - if it says 1 when you pasted 20 lines, your delimiter is wrong.

    Second trap: this is a plain str.split(). It has zero idea about wildcards like {red|blue} or [a] scheduling - that's a Dynamic Prompts–style pack's job. Don't come here for randomized prompt generation; come here for the dumb, dependable "run these exact N prompts in order" case, which honestly covers most batch work. The other gotcha isn't a bug: prompts are trimmed of surrounding whitespace unconditionally, which is usually what you want anyway.

    One more tip while you're here: pair this with the pack's Get Prompt From Batch node if you want to step through prompts one at a time instead of firing all of them.

    Categorytext

    Inputs (3)

    NameTypeDefaultDescription
    textSTRINGprompt 1 prompt 2 prompt 3
    delimiterSTRING
    skip_emptyBOOLEANtrue

    Outputs (2)

    NameTypeDescription
    prompts_listSTRING
    countINT