Text Index Switch 5
Put sampler settings inside the prompt — the node strips them back out
- text
- label
- index
- model
- sampler
- scheduler
- cfg
- steps
- seed
A plain text index switch picks a prompt and hands it down - fine, but then you still have to deal with the fact that different prompts want different sampler settings. AUNTextIndexSwitch5 is the version that lets you put those settings inside the prompt. It switches between up to 20 text slots (Select / Increment / Random / Range modes, same as the rest of the AUN text-switch family), then scans the selected text for key=value tokens - model, sampler, scheduler, cfg, steps, seed - outputs each as a typed value on its own socket, and removes those tokens from the text output so your prompt stays clean.
So a slot containing:
sampler=dpmpp_2m scheduler=karras cfg=4.5 steps=22 seed=7
A cinematic portrait, soft light
...outputs "A cinematic portrait, soft light" as text, plus a sampler STRING of dpmpp_2m, a scheduler STRING, a cfg FLOAT of 4.5, steps INT of 22, and seed INT of 7. Token values can be a single space-free token or quoted (cfg="1.4"), and keys match case-insensitively. Any key=value pair not on that list is left alone in the text - so unrelated tokens don't get mangled.
Inputs are the standard index-switch set: minimum, maximum, mode, index, slot_count (how many of the 20 text slots show), range (for Range mode, e.g. 1,2,5-8,12), and text1–text20. Outputs: text, label, index, plus the six extracted values (model, sampler, scheduler, cfg, steps, seed). The label is derived from the connected node title, a custom label, or the first line of the text. When a token is absent from the selected text, its output falls back to a default - cfg defaults to 2.0, steps to 10, seed to 0.
Where this pays off: dynamic prompt sets where every variation carries its own sampler recipe. Wire cfg/steps/seed into a KSampler (convert those widgets to inputs) and the whole sampling setup follows the prompt automatically. Feed index into AUNLoRAsByPromptIndex and the LoRA stack follows too. The model token is a string, not a loaded model - that's for naming/tracking or for loaders that accept a string name, not a checkpoint loader replacement.
Note this is the predecessor to AUNInputsBasicSwitch, which folds an actual checkpoint loader into the same node. If you want the loader built in, use that one; if you want a pure prompt-side switch whose extracted values you wire yourself, this is it.
Install: ComfyUI Manager (search "AUN"), or cd ComfyUI/custom_nodes && git clone https://github.com/loz2754/AUN-ComfyUI-Nodes, restart; pip install -r requirements.txt if a manual install complains about missing piexif/cv2.
Troubleshooting:
- A token stays in your prompt output → the key isn't on the known list (only the six are stripped) or it's malformed (needs
key=valuewith no spaces around=). - Dynamic modes (Increment/Random/Range) re-execute every run - expect a new pick each queue.
- The
cfg/steps/seedsockets look like they do nothing until you actually wire them into your sampler; they're values, not magic.
Inputs (26)
| Name | Type | Default | Description |
|---|---|---|---|
| minimum | INT | 11–20 | The minimum index for selection (inclusive). |
| maximum | INT | 101–20 | The maximum index for selection (inclusive). |
| mode | COMBO | Select | Select mode: Select for fixed index, Increment for cycling through range, Random for random index within range, Range for selecting from a list of indices. |
| index | INT | 11–20 | Current or target index, constrained by slot_count). |
| slot_count | INT | 21–20 | Number of visible text slots. |
| range | STRING | 1,2,5-8,12 | A comma-separated list of indices or ranges to select from in Range mode (e.g. 1, 2, 5-8, 12). |
| text1 | STRING | Slot 1 | — |
| text2 | STRING | Slot 2 | — |
| text3 | STRING | Slot 3 | — |
| text4 | STRING | Slot 4 | — |
| text5 | STRING | Slot 5 | — |
| text6 | STRING | Slot 6 | — |
| text7 | STRING | Slot 7 | — |
| text8 | STRING | Slot 8 | — |
| text9 | STRING | Slot 9 | — |
| text10 | STRING | Slot 10 | — |
| text11 | STRING | Slot 11 | — |
| text12 | STRING | Slot 12 | — |
| text13 | STRING | Slot 13 | — |
| text14 | STRING | Slot 14 | — |
| text15 | STRING | Slot 15 | — |
| text16 | STRING | Slot 16 | — |
| text17 | STRING | Slot 17 | — |
| text18 | STRING | Slot 18 | — |
| text19 | STRING | Slot 19 | — |
| text20 | STRING | Slot 20 | — |
Outputs (9)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| label | STRING | — |
| index | INT | — |
| model | STRING | — |
| sampler | STRING | — |
| scheduler | STRING | — |
| cfg | FLOAT | — |
| steps | INT | — |
| seed | INT | — |