ComfyUI Node

List Selector

Step through a prompt list across queue runs

By Santodan·Created about a year ago·Updated 2 months ago· 28
List Selector
  • prompt_list
  • prompt
  • current_index
mode
index0
stop_at_endfalse
reset_counterfalse

If you batch-generate, you've hit the problem this node exists for: you have a LIST of prompts (from this pack's PromptListWithTemplates, or the Wildcard Manager's line-by-line output, or any other list source) and you want each queue run to consume one item from the list, in order, without manually rewiring anything between runs. The List Selector remembers where it is per node and hands out the next prompt each time.

Think of it as a cursor over a list that persists across queue runs. Impact Pack has its own PromptList; this is the "walk through the list one at a time" companion.

How it works

The node keeps a per-instance counter keyed by its node ID in a class-level dictionary, so each List Selector in your workflow tracks its own position independently. Each run, it picks based on mode:

  • all_run - dumps the whole list out at once (useful for batch of N).
  • selected - jumps to a fixed index and returns only that item. No state, pure lookup.
  • increment - returns the current item, then advances the counter. This is the mode that makes "one prompt per queue run" work.

In increment mode, stop_at_end decides the end-of-list behavior: False (default) loops back to the start; True halts the queue (it calls ComfyUI's interrupt_processing) and tells you to reset. The reset_counter toggle resets the position to zero - it's a one-shot switch the frontend flips back after use, so you click it and the next run starts from the top.

Inputs / outputs

  • prompt_list (required) - a LIST input; feed it any list-typed output.
  • mode - all_run / selected / increment.
  • index - target index for selected mode.
  • stop_at_end, reset_counter - end-of-list and reset behavior.
  • Outputs: prompt (a list - even a single item comes wrapped, which matches how prompt lists flow in ComfyUI) and current_index (the position, so you can log or preview which prompt fired).

Gotchas

  • The output is always a list. selected and increment return a one-element list. If your downstream expects a plain string, take current_index and re-index, or unwrap with a list-to-string helper - the pack's own prompt nodes accept LIST inputs, so it usually just connects.
  • Counter state is per node, in memory. It lives in the process, keyed by node ID. Copy-paste a duplicate of the node and it gets its own counter (new ID). Restart ComfyUI and all counters reset to zero - fine for most uses, surprising if you expected persistence across sessions.
  • IS_CHANGED always returns "changed." The node re-executes every run by design so it can advance the cursor, which means it won't be skipped by ComfyUI's caching. That's correct behavior, not a bug.

Install

ComfyUI Manager (search "Santodan"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/Santodan/santodan-custom-nodes-comfyui

Restart. No dependencies, no downloads.

CategorySantodan/Prompt

Inputs (5)

NameTypeDefaultDescription
prompt_listLIST
modeCOMBO3 options: all_run, selected, increment
indexINT00–18446744073709550000
stop_at_endBOOLEANfalse
reset_counterBOOLEANfalse

Outputs (2)

NameTypeDescription
promptSTRING
current_indexINT