Nodes/ComfyUI-Multiline-Text-Prompt/Multiline Prompt Sequencer
ComfyUI Node

Multiline Prompt Sequencer

One Text Box, A Hundred Prompts

By Mileshighclub69·Created a day ago·Updated about 21 hours ago· 0
Multiline Prompt Sequencer
    • current_prompt
    • line_index
    multiline_textA beautiful sunset over mountains A futuristic cyberpunk street at night A close up portrait of an astronaut
    current_line0
    modeincrement

    What this is for

    You have thirty prompt ideas and you want thirty images. The normal ComfyUI answer is either to paste a new prompt in after every run, or to wire up something clever with wildcards, seeds and index math. Multiline Prompt Sequencer is the lazy version: paste all thirty prompts into one text box, one per line, plug the output into your CLIP Text Encode, and let the node feed them to the sampler one run at a time.

    It's plumbing: no models, no dependencies, no cleverness with the text encoder - just a cursor for a list. That's why it exists, in the corner of ComfyUI where you generate prompt variety without writing more prompts, next to the {a|b|c} bracket syntax and Impact Pack's __wildcard__ system most workflows lean on without knowing who supplies it.

    How it works

    The node holds the whole list in a widget, splits it on newlines, throws away blank lines, and returns whichever line the counter currently points at. The index math is a modulo, so it wraps - pass the end of the list and you're back at the top instead of crashing or returning an empty string.

    The counter is where it gets interesting. The Python side doesn't move the number at all: it reads current_line, does current_line % len(lines), and hands back the line plus the resolved index. The increment is done by the pack's JavaScript extension, which hooks the node's execution callback and ticks the current_line widget up (or down) in the browser after each run. The README calls it a "visual auto-counter," and it isn't a marketing flourish - the number really is a frontend thing, which explains a set of behaviours you'd otherwise file under "weird".

    Two consequences fall straight out of that. First, the node is marked as always-changed via the float("NaN") trick, so ComfyUI never caches it and it re-fires on every queue. Second, because the tick happens in the browser, your mode choice is only ever interpreted by the frontend: the Python function accepts mode as an argument and then ignores it.

    The inputs that actually matter

    • multiline_text - the list. One prompt per line, blank lines ignored. Paste, don't agonise.
    • current_line - which line you're on, 0-based. The JS moves this for you; you only touch it when you want to start somewhere specific, or when you're driving the graph from the API.
    • mode - increment walks down the list, decrease walks up, fixed freezes on the current line so you can iterate on one prompt while keeping the rest of the list intact. increment is what you want 95% of the time.

    Two outputs. current_prompt (STRING) goes into your CLIP Text Encode - that's the whole point of the node. line_index (INT) is the resolved, wrapped index, which is handy for a filename prefix or as a seed when you want run number seven to be reproducible later.

    Installing it

    ComfyUI Manager first - search the pack title, "Multiline Text Prompt", and install from there. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Mileshighclub69/ComfyUI-Multiline-Text-Prompt
    

    Restart ComfyUI, hard-refresh the browser tab, and you'll find the node under utils/text. There's nothing else to do: no requirements.txt, no pip step, no model downloads, no checkpoints. The Python side imports only random, and the pack ships its own small JS file over WEB_DIRECTORY, which is how the counter gets to your browser - the repo is a README, a node file, and that script.

    Then wire it up: current_prompt → CLIP Text Encode positive, mode to increment, paste your list, queue. Each run advances a line; at the bottom it wraps.

    Where people get burned

    Queuing several runs at once. Each Queue click snapshots the graph as it is at that instant, and the counter only ticks once a run finishes - so five rapid clicks with the queue backing up can send the same line five times. Use Auto Queue in instant mode and let it chain run after run - that's the rhythm this node is built for, and it's how people run 100+ generations off one paste.

    Driving it from the API or a script. No browser means no JavaScript, which means no tick - the workflow renders line zero forever. Set current_line explicitly per request instead; fine, just not the point-and-click experience the pack advertises.

    Expecting the counter to walk inside a batch. The step is per execution, not per image, so a batch size of 4 gives you four variations of the same prompt - usually what you want, but it surprises anyone expecting the list to unspool across the batch.

    Assuming fixed is broken. It does nothing by design. If the node seems stuck on line one, check that dropdown before you reinstall anything.

    Categoryutils/text

    Inputs (3)

    NameTypeDefaultDescription
    multiline_textSTRINGA beautiful sunset over mountains A futuristic cyberpunk street at night A close up portrait of an astronaut
    current_lineINT00–999999
    modeCOMBOincrement3 options: increment, decrease, fixed

    Outputs (2)

    NameTypeDescription
    current_promptSTRING
    line_indexINT