easy textIndexSwitch
Pick one text input by number
- text
A boolean switch picks between two things. This one picks between many, by number. easy textIndexSwitch takes a stack of text inputs and an index, and outputs whichever text sits at that index. It's how you select one prompt (or filename, or any string) out of a list programmatically - set the index by hand, or better, drive it from something that changes, like a loop counter or a computed value, and you've got prompt-switching that reacts to the rest of your graph.
What it's for
The obvious use is a menu of prompts. Load up text0 through however many with different scene descriptions, and flip the index to choose which one runs - no rewiring, no deleting connections. Where it gets interesting is driving the index dynamically: pair it with easy forLoopStart's index output and each loop iteration selects a different text, so a single run walks through your whole list. Or compute the index with easy simpleMath and let some condition decide which prompt fires. That's the difference between a static switch and actual routing logic.
The inputs and outputs that matter
index- the selector, an integer. It's the whole control surface; whatever number it holds picks the matching text slot.text0,text1,text2, … (optional strings) - the candidate texts. Connect as many as you need; you can wire in string outputs from other nodes or type directly. Empty slots you leave unconnected.
The single output is text - the selected string - which you send into a CLIP text encode, a loader prompt input, or anywhere a string belongs.
Installing it
Bundled with the pack. Install ComfyUI-Easy-Use via ComfyUI Manager (search ComfyUI Easy Use, restart) or:
cd ComfyUI/custom_nodes
git clone https://github.com/yolain/ComfyUI-Easy-Use
Install requirements, restart. Nothing else needed.
Where it bites
The main thing to watch is the index pointing at an empty or nonexistent slot. If index is 5 but you only wired up text0–text2, you'll get an empty string (or an error, depending on version) rather than a helpful warning - and an empty prompt tends to fail quietly downstream rather than loudly. Keep the index inside the range of slots you actually connected, and if you're driving it from a loop, make sure the loop count and the number of texts line up.
The other consideration is the same one that applies to every switch: the unselected inputs may still be evaluated. If a text slot is fed by an expensive chain (say a VLM captioner), that work can happen even when you didn't select it. For plain typed strings this costs nothing, so it's usually a non-issue here - but worth remembering if your text inputs come from heavy upstream nodes. As a clean "choose prompt N from this list" tool, though, it's exactly the right node, especially once you start driving the index instead of setting it by hand. If you need to switch non-text types, the pack has matching index-switch nodes for images and "anything."
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| index | INT | 00–9 | — |
| text0opt | STRING | — | |
| text1opt | STRING | — | |
| text2opt | STRING | — | |
| text3opt | STRING | — | |
| text4opt | STRING | — | |
| text5opt | STRING | — | |
| text6opt | STRING | — | |
| text7opt | STRING | — | |
| text8opt | STRING | — | |
| text9opt | STRING | — | |
| text10opt | STRING | — | |
| text11opt | STRING | — | |
| text12opt | STRING | — | |
| text13opt | STRING | — | |
| text14opt | STRING | — | |
| text15opt | STRING | — | |
| text16opt | STRING | — | |
| text17opt | STRING | — | |
| text18opt | STRING | — | |
| text19opt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |