String Selector
Keep a stack of prompts in one box and pick one by number
- STRING
Keep a list of prompts in one text box and switch between them with a single number. That's String Selector. Instead of maintaining five copies of a workflow with five different prompts, you paste all five into this node and change one integer to pick which one is active. Handy for A/B testing prompts, cycling through variations in a batch, or driving different generations from an automated loop where a counter feeds the selector.
It reads a multi-line string and returns a slice of it, with the exact behavior depending on one mode toggle.
How it works
With multiline off, it treats the text as a plain list of lines and returns the single line at your select index. Line 0, line 1, line 2 - one prompt per row. With multiline on, it instead splits the text on lines that start with #, so each block between # markers is one selectable entry that can itself span several lines. That's the mode for longer prompts you don't want crammed onto one row.
The nice touch: if select goes past the number of entries, it wraps around and counts from the top again. So a counter that keeps incrementing will just cycle through your options forever rather than erroring out - which is exactly what you want when this is driven by a loop.
The inputs and outputs that matter
strings(multiline STRING) - your list of options. One per line in normal mode, or#-delimited blocks in multiline mode.multiline(default off) - off = one line per option; on =#-delimited multi-line blocks. Pick based on how long each option is.select(default 0) - the index to return, zero-based. Wraps around past the end.
The single output is a STRING - the chosen entry, ready to send to a CLIP Text Encode or anywhere else a prompt goes.
How to install it
ComfyUI Manager: search ComfyUI Impact Pack, Install, restart.
Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack
cd ComfyUI-Impact-Pack
pip install -r requirements.txt
Run the pip in ComfyUI's Python environment and restart. No models or extra dependencies.
Common issues & troubleshooting
You're getting the wrong line, off by one. select is zero-based: 0 is the first line, not 1. Almost every "it's picking the wrong prompt" report is this.
Multiline mode returned everything mashed together. In multiline mode, entries are separated by lines starting with #. If you didn't put # markers in, the whole text is treated as one entry. Add the # delimiters, or switch multiline off and use one line per option.
Blank lines counting as options. In single-line mode an empty row is still a row. If your indexing feels off, check for stray blank lines in the box.
Want to combine strings instead of select one? That's the other direction - String List to String joins a list into one string. This node goes the other way, pulling one entry out of a block.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| strings | STRING | — | |
| multiline | BOOLEAN | false | — |
| select | INT | 00–9223372036854776000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |