Prompt Switch (10)
Swap between ten prompts with one number — no graph surgery
- selected_text
You've got a workflow that's basically good, except every character or style variant means a different prompt block - and you've been handling that by duplicating the whole graph and editing one string. Stop doing that. Prompt Switch (10) from itom0717's Prompt String Selector pack is the node that turns "which prompt runs" into a single integer.
What it is
A string router. It takes an id (an INT from 1 to 10) and passes through exactly one of the ten text_01–text_10 inputs you've connected, out as selected_text. Change the number, get a different prompt. No rewiring, no copy-paste, and because id is a real input you can drive it from another node - one workflow, ten variants, flip a number (or wire a random INT into id if you want chaos).
One thing to clear up fast: despite the name, this is not the "prompt switch" you see in A1111-land - the [Dog|Cat] thing that alternates tokens every N steps. That's prompt scheduling; comfyui-prompt-control and KepPromptLang do that. This node is a static router: pick one connected string, output it. Both get called "switch" and they solve different problems. If you came here wanting per-step alternation, wrong node.
How it works
Read the source and it's delightfully simple:
idis required, INT, default 1, min 1, max 10.- The input labels are two-digit:
text_01throughtext_10, nottext_1. Easy to miss when you're poking at workflow JSON. - The chosen string gets whitespace-stripped and a
,\nappended unless it already ends in a comma. That trailing comma is deliberate - the output is meant to chain into the pack's Aggregator or into a CLIP text encode alongside other prompt parts. - If the pin for the chosen
idisn't connected, or is empty, you get an empty string. No error, no fallback. This is the thing that bites people: the node never crashes, so "my prompt vanished" is almost always "I switched to an id whose pin is empty."
The inputs and outputs that matter
id is the one you actually touch. text_01–text_10 are optional STRINGs with forceInput set, so they want to be wired - from the pack's Character or Art Style selectors, from a PrimitiveStringMultiline, anywhere a string lives. The output is selected_text (STRING), which feeds your CLIP Text Encode or an aggregator.
The pack's sample workflow shows the pattern: an ID Select node feeds id into a Prompt Switch, whose selected_text drops into an Aggregator next to Character and Art Style selectors. Character A or character B becomes one integer.
Install
Same as the whole pack - pure Python, no requirements, no model downloads, MIT license:
cd ComfyUI/custom_nodes
git clone https://github.com/itom0717/ComfyUI-Prompt-String-Selector
Restart ComfyUI (a page refresh too, so the nodes register). Or use ComfyUI Manager → Install via Git URL with the same repo address.
Gotchas worth knowing
- An
idout of range - say, 11 fed from an upstream node - looks fortext_11, finds nothing, and silently outputs an empty string. Clamp it upstream or you'll chase ghosts. - Nothing auto-advances. It's a router, not a randomizer; randomness is your job to add.
- Ten inputs is a lot of wires on canvas. If you only have two or three variants, the (5) version is the same node with less clutter.
Which one do you actually want? For most people, honestly, this one. Ten variants is a sane ceiling and the middle child here is the right default. You'll know you need the (20) when you're running a real prompt library with more than ten entries.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| id | INT | 11–10 | — |
| text_01opt | STRING | — | |
| text_02opt | STRING | — | |
| text_03opt | STRING | — | |
| text_04opt | STRING | — | |
| text_05opt | STRING | — | |
| text_06opt | STRING | — | |
| text_07opt | STRING | — | |
| text_08opt | STRING | — | |
| text_09opt | STRING | — | |
| text_10opt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| selected_text | STRING | — |