Index Picker
Pick one prompt out of a batch
- item
String Splitter hands you a list of prompts. Most ComfyUI nodes can't take a list and will iterate over it - great if you want a batch, annoying if you want exactly one element wired somewhere. Index Picker grabs the one item you want by position, and it's the natural companion to the splitter in this same pack.
The mechanism
It's a small node: items is a list input you connect from a list-producing node, index is an integer widget, and out comes a single STRING. Zero-based, so index 0 is the first item.
One detail is worth understanding because it explains the node's weird little habits. It sets INPUT_IS_LIST = True, which tells ComfyUI to pass the entire list into items in one call instead of running the node once per element. That's what makes it different from a plain input - and it's also why the index arrives wrapped in a list too, which the node painstakingly unwraps, converts to int, and then clamps to the valid range rather than erroring. Ask for item 50 in a three-item list and you quietly get the last one.
Inputs and output
- items (STRING list) - connect the list output of String Splitter or any fan-out node.
- index (INT, 0–999) - which element to return.
Output: item (STRING) - the picked string, ready to feed a prompt input, a filename, whatever.
Every run also prints a [IndexPicker DEBUG] block to the console showing the list and the resolved index. That's genuinely useful the first time you wire it (you can see it clamp), and easy to ignore forever after.
If you find yourself picking a random index to shuffle through a batch, you're doing it manually - which is fine, but it hints you might actually want a random-index node instead. For "I saved 20 prompts and I want to test number 7," this is the node.
Installing this node
One of the 16 nodes in the lzits Nodes pack (Lior Zitser, MIT). Install once via ComfyUI Manager (search "lzits Nodes") or:
cd ComfyUI/custom_nodes
git clone https://github.com/lzitser23/lzits-nodes.git
Restart ComfyUI. No extra dependencies.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| items | STRING | — | |
| index | INT | 00–999 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| item | STRING | — |