Prompt Batch Selector (by line) v1.2.1
One node, a whole stack of prompts — swap a line per queue
- clip
- CONDITIONING
You've got a character, a style, and ten outfit variations to test. The boring way is ten CLIP Text Encode nodes and a pile of unplugged cables. This node is the compact alternative: you paste one prompt per line, feed it a number, and it CLIP-encodes the line you asked for. Drive the number from a counter node and a whole prompt sweep becomes one queue click after another.
How it works
PromptBatchSelector splits the prompts_by_line box on newlines, grabs the line at batch_index minus one (yes, it's 1-based - more on that below), and glues it onto your common_prompt. The combined text is then handed to ComfyUI's own CLIPTextEncode under the hood, so what comes out the CONDITIONING port is byte-for-byte the same kind of conditioning any native node produces. No tricks, no custom encoder, no API calls. The index math happens once per execution; whatever number you feed in decides the line.
The practical setup is dead simple: common_prompt holds the stuff every image should have ("beautiful scenery, masterpiece, best quality"), prompts_by_line holds what changes ("a happy person smiling", "a sad person crying"...), and batch_index picks the variant. Wire the CONDITIONING output straight into a KSampler's positive input.
The inputs that matter
- batch_index - which line to use. 1-based, min 1. This is what you drive from a loop counter if you're automating.
- common_prompt - always included, prefix to whatever line you select.
- prompts_by_line - one prompt per line; this is your variation list.
- clip - the CLIP model from your checkpoint or dual-clip loader.
Install
Same story as every node in this pack - via ComfyUI Manager (search "AcademiaSD") or:
cd ComfyUI/custom_nodes
git clone https://github.com/AcademiaSD/comfyui_AcademiaSD
Then restart ComfyUI. The pack ships no requirements.txt and this node needs nothing extra - it's pure ComfyUI API.
Where people get burned
The 1-based index. Your instinct after a few hours in ComfyUI is 0-based everywhere, and batch_index is one higher than the list position. More importantly: out of range is silent. If your counter runs past the last line, the node prints a warning in the console and encodes just the common prompt - no error, no red node, and you'll burn a whole queue wondering why the variation vanished.
Also remember it's a selector, not a generator. There's no control_after_generate knob here; the value only changes when something upstream changes it. Pair it with a loop counter node (AcademiaSD's own LoopCounterToFile or AcademiaSD_LoopCounter work well) so each queue bumps the index, and you've got yourself a batch prompt runner in two nodes. That combination is where this node actually earns its keep.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| batch_index | INT | 1 | — |
| common_prompt | STRING | beautiful scenery, masterpiece, best quality | — |
| prompts_by_line | STRING | a happy person smiling a sad person crying an angry person shouting | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |