Nodes/ComfyUI Prompt Iterator Extension/Prompt Iterator (Dynamic Inputs)
ComfyUI Node

Prompt Iterator (Dynamic Inputs)

Prompt Iterator (Dynamic Inputs)

By BizaNator·Created 11 months ago·Updated 11 months ago· 5
Prompt Iterator (Dynamic Inputs)
    • prompt
    • filename
    • current_index
    • total_count
    • status
    • seed
    modesequential
    filename_modeauto_index
    base_filenameoutput
    prompt_1
    prompt_2
    prompt_3
    prompt_4
    prompt_5
    prompt_6
    prompt_7
    prompt_8
    suffixes
    filename_template{base}_{index:03d}
    manual_index0
    resetfalse
    generation_seed-1
    seed_modeincrement_batch
    workflow_iddefault
    prompt_9
    prompt_10
    prompt_11
    prompt_12
    prompt_13
    prompt_14
    prompt_15
    prompt_16
    prompt_17
    prompt_18
    prompt_19
    prompt_20

    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, or single, same as Advanced.
    • filename_mode - auto_index (default), suffix_list, or template. There's no exact-filenames list mode 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 a seed output.
    • 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.

    Categoryutils/prompt

    Inputs (30)

    NameTypeDefaultDescription
    modeCOMBOsequential4 options: sequential, manual, random, single
    filename_modeCOMBOauto_index3 options: auto_index, suffix_list, template
    base_filenameSTRINGoutput
    prompt_1optSTRING
    prompt_2optSTRING
    prompt_3optSTRING
    prompt_4optSTRING
    prompt_5optSTRING
    prompt_6optSTRING
    prompt_7optSTRING
    prompt_8optSTRING
    suffixesoptSTRING
    filename_templateoptSTRING{base}_{index:03d}
    manual_indexoptINT00–9999
    resetoptBOOLEANfalse
    generation_seedoptINT-1-1–2147483647
    seed_modeoptCOMBOincrement_batch4 options: fixed, increment_batch, increment_prompt, random
    workflow_idoptSTRINGdefault
    prompt_9optSTRING
    prompt_10optSTRING
    prompt_11optSTRING
    prompt_12optSTRING
    prompt_13optSTRING
    prompt_14optSTRING
    prompt_15optSTRING
    prompt_16optSTRING
    prompt_17optSTRING
    prompt_18optSTRING
    prompt_19optSTRING
    prompt_20optSTRING

    Outputs (6)

    NameTypeDescription
    promptSTRING
    filenameSTRING
    current_indexINT
    total_countINT
    statusSTRING
    seedINT