Nodes/Qaz Tools/Text Switch (Index)
ComfyUI Node

Text Switch (Index)

Five text slots, one index

By qazwsxedc121·Created 3 months ago·Updated 3 months ago· 1
Text Switch (Index)
    • STRING
    index0
    text0
    text1
    text2
    text3
    text4

    Text Switch (Index) is the five-slot version of the pack's 2-way switch: an index integer and five literal text fields, text0 through text4. Set the index and the matching slot comes out as the STRING. It's a plain n-way text selector with the n fixed at five, and it's the right tool when two slots aren't enough but you don't want to install a whole utility suite for it.

    This is your node for switching between several prompt presets from one widget - five artist styles, five LoRA trigger blocks, five lighting setups - and then driving the choice from anywhere that emits an INT: a widget on the node, a random integer node, or a workflow controller that picks a slot per run. Combined with a fixed sampler seed it's a tidy way to run a five-way style comparison from a single canvas without duplicating the text encode path.

    How it works

    The node builds its inputs in a loop (text0..text4), and execute does a dictionary lookup: kwargs.get(f"text{index}", ""). Set the index, get the text. The slots are plain literal multiline strings - no {a|b} or wildcard processing happens here, they pass through verbatim - and the output is a single STRING.

    The inputs that matter

    • index - integer, 0 to 4, default 0. The widget clamps to that range, so a hand-set index always lands.
    • text0..text4 - the five candidate strings, all optional, all multiline.

    If you drive index from another node rather than the widget, keep it in 0–4 - an out-of-range index resolves to an empty string (kwargs.get returns ""), so a bad value silently produces an empty prompt rather than an error. Check the number on the wire before you blame the node.

    Installing Qaz Tools

    Same as every node in the pack: Qaz Tools is a small personal toolkit from qazwsxedc121, no models, no requirements.txt. Install, then restart ComfyUI:

    cd ComfyUI/custom_nodes
    git clone https://github.com/qazwsxedc121/comfyui-qaz-tools
    

    Or in ComfyUI Manager, search "Qaz Tools" / paste the repo URL under Install via Git URL.

    That's the entire surface area. If you need more than five slots, wire two of these together or grab a bigger switch from another pack - but for a five-way prompt preset, this is as minimal as it gets.

    CategoryQaz Tools

    Inputs (6)

    NameTypeDefaultDescription
    indexINT00–4
    text0optSTRING
    text1optSTRING
    text2optSTRING
    text3optSTRING
    text4optSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING