Prompt Iterator (Dynamic Inputs)
Prompt Iterator (Dynamic Inputs)
- prompt
- filename
- current_index
- total_count
- status
- seed
Here's the twist on the iterator idea: instead of one big multiline text box, this node hands you up to 20 separate prompt inputs that you wire other nodes into. You don't type a single prompt - you connect text nodes, or any node that outputs a string, and the iterator auto-detects which inputs are actually connected and cycles through just those. It's the "prompts as Lego bricks" version, and it's the newest of the three nodes in the pack (added in v2.0, seed support in v2.1).
How it works
Same machinery as its siblings: state in a module-level dict keyed by workflow_id, and sequential/random modes force re-execution on every queue press so the node advances one step per run. The difference is the input side - at execution it scans prompt_1 through prompt_20, keeps the non-empty ones, and builds a list from those.
Two things trip people up here. First, the prompt fields are marked forceInput in the source, which means they're connection sockets, not widgets - you literally cannot type a prompt into the node. The field looks like a text box, but the widget is hidden; you must wire a Text node in. Second, the index is the position in the collected list, not the input number. Wire only prompt_1 and prompt_3 and index 1 is prompt_3 - don't assume the gaps line up.
The inputs that matter
- prompt_1 … prompt_20 - wire your text sources in. Unused slots are just skipped.
- mode -
sequential,manual,random, orsingle, same as Advanced. - filename_mode -
auto_index(default),suffix_list, ortemplate. There's no exact-filenameslistmode here; you pick suffixes or a template. - base_filename, plus suffixes and filename_template for the two naming modes.
- generation_seed + seed_mode - the same four modes as Advanced (
fixed,increment_batch,increment_prompt,random), feeding aseedoutput. - reset, workflow_id - reset the cursor, or keep state stable.
What you wire it into
prompt_1 → Text node: "face front view"
prompt_2 → Text node: "face left profile"
prompt_3 → Text node: "face right profile"
prompt → CLIPTextEncode text
filename → SaveImage filename_prefix
seed → KSampler seed
Queue three times and you've got your three angles, each with a sane filename and a seed you can reproduce.
Install
ComfyUI Manager, search "ComfyUI Prompt Iterator Extension" - or git clone https://github.com/BizaNator/ComfyUI_PromptIterator into ComfyUI/custom_nodes/ and restart. No dependencies, no models, nothing to download; it appears under utils/prompt alongside the basic and Advanced iterators.
Gotchas
- Connection-only inputs. If you're used to the basic node, the lack of a text box feels broken. It's not - grab a Text node and wire it up.
- Empty input list. With nothing wired, the "no prompts provided" path returns five values against six declared outputs, so you get an error rather than a graceful "0 prompts." Always leave at least one input connected.
- Per-session state. Restart ComfyUI and the cursor is back at prompt 1.
- It's more setup than the basic node - three prompts means three text nodes plus three wires. For a one-off list, basic is genuinely less work.
That setup cost is the honest trade-off. The payoff is modularity: you can swap a prompt source - a wildcard expansion, another workflow's text output, a style reference - by moving a wire instead of editing a block of multiline text. If your prompts live in your head and a text file, use the basic node; if they come from other nodes, this is the one.
Inputs (30)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | sequential | 4 options: sequential, manual, random, single |
| filename_mode | COMBO | auto_index | 3 options: auto_index, suffix_list, template |
| base_filename | STRING | output | — |
| prompt_1opt | STRING | — | |
| prompt_2opt | STRING | — | |
| prompt_3opt | STRING | — | |
| prompt_4opt | STRING | — | |
| prompt_5opt | STRING | — | |
| prompt_6opt | STRING | — | |
| prompt_7opt | STRING | — | |
| prompt_8opt | STRING | — | |
| suffixesopt | STRING | — | |
| filename_templateopt | STRING | {base}_{index:03d} | — |
| manual_indexopt | INT | 00–9999 | — |
| resetopt | BOOLEAN | false | — |
| generation_seedopt | INT | -1-1–2147483647 | — |
| seed_modeopt | COMBO | increment_batch | 4 options: fixed, increment_batch, increment_prompt, random |
| workflow_idopt | STRING | default | — |
| prompt_9opt | STRING | — | |
| prompt_10opt | STRING | — | |
| prompt_11opt | STRING | — | |
| prompt_12opt | STRING | — | |
| prompt_13opt | STRING | — | |
| prompt_14opt | STRING | — | |
| prompt_15opt | STRING | — | |
| prompt_16opt | STRING | — | |
| prompt_17opt | STRING | — | |
| prompt_18opt | STRING | — | |
| prompt_19opt | STRING | — | |
| prompt_20opt | STRING | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |
| filename | STRING | — |
| current_index | INT | — |
| total_count | INT | — |
| status | STRING | — |
| seed | INT | — |