Nodes/AUN ComfyUI Nodes/Text Index Switch 3
ComfyUI Node

Text Index Switch 3

Prompt slots that label themselves

By loz2754·Created 8 months ago·Updated a day ago· 5
Text Index Switch 3
    • text
    • label
    • index
    index1
    slot_count2
    text1Slot 1
    text2Slot 2
    text3Slot 3
    text4Slot 4
    text5Slot 5
    text6Slot 6
    text7Slot 7
    text8Slot 8
    text9Slot 9
    text10Slot 10
    text11Slot 11
    text12Slot 12
    text13Slot 13
    text14Slot 14
    text15Slot 15
    text16Slot 16
    text17Slot 17
    text18Slot 18
    text19Slot 19
    text20Slot 20

    The AUN pack ships four text index switches, and the numbers aren't versions - they're personalities. Text Index Switch 3 is the one that treats prompt slots as little labeled cards: it gives you an index output, a label output, and a clever text-slot convention where the first line of a slot doubles as its name. If you've ever stared at "Slot 1" and forgotten which prompt that was, this node was written for you.

    What it does

    Like the others, it selects one of up to 20 text slots by index and outputs the chosen text. The difference is in the label behavior, and it's genuinely neat:

    • If a node is connected to the input, the label is that connected node's title.
    • If no node is connected, the label is the first line of the text input - and that first line is stripped out of the text output.

    So you type cinematic bokeh\nA portrait in a rainy alley, warm neon into a slot. The label reads "cinematic bokeh," and the actual prompt sent to CLIP is just "A portrait in a rainy alley, warm neon." The first line becomes the name, free of charge, no extra node needed. That single convention is why this is the one I reach for when I'm building multi-prompt workflows by hand.

    Inputs and outputs

    • index - selects which slot, 1–20.
    • slot_count - how many slots are visible/active. Unlike the "visible_inputs" of the V1 switch, this actually bounds which slots are considered - the node builds its text list from slots 1..slot_count.
    • text1text20 - the slots, multiline. Defaults say "Slot 1", "Slot 2" so you always know what's where before you rename them.

    Outputs: text, label, and index (the active index, handy for chaining into other controllers).

    How it works

    Slots are regular multiline widgets on the node, saved with the workflow. On execution it clamps slot_count, collects the active slots, and picks the one at index. The first-line-as-label trick comes from a simple parse: the first line is peeled off for the label and the remainder becomes the prompt. When a node is wired in instead, the connected title wins as the label. It also records its state into the workflow's extra info, so the node remembers its slot count and index across reloads.

    Where it fits

    Text Index Switch 3 sits between the bare V1 (index + text, no built-in index generation) and the all-in-one Text Index Switch 4 (which adds Select/Increment/Random/Range modes). This one's strength is organization: the label convention means your filenames and display nodes get meaningful names without any extra wiring. It also uses dynamicPrompts on its slots, so you can drop wildcard-style expressions into them.

    The tradeoff is that it doesn't generate its own index - feed it from an AUN Random/Select INT or a counter. If you want the randomness built in, Text Index Switch 4 does that; if you want the cleanest labeling convention, this is the one.

    Installing

    It's part of the AUN ComfyUI Nodes pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/loz2754/AUN-ComfyUI-Nodes
    

    Restart ComfyUI, or install via ComfyUI Manager (search "AUN"). No model downloads or heavy deps; the pack's requirements (piexif, opencv-python-headless, requests, imageio-ffmpeg) are auto-installed by Manager. If you cloned manually, pip install -r custom_nodes/AUN-ComfyUI-Nodes/requirements.txt covers it.

    One habit that pays off: use the first-line convention consistently and your prompt slots become self-documenting. A workflow that's been sitting for two months still makes sense when every slot announces itself.

    CategoryAUN Nodes/Prompts

    Inputs (22)

    NameTypeDefaultDescription
    indexINT11–20Selects which text input to output.
    slot_countINT21–20Number of visible text slots
    text1STRINGSlot 1
    text2STRINGSlot 2
    text3STRINGSlot 3
    text4STRINGSlot 4
    text5STRINGSlot 5
    text6STRINGSlot 6
    text7STRINGSlot 7
    text8STRINGSlot 8
    text9STRINGSlot 9
    text10STRINGSlot 10
    text11STRINGSlot 11
    text12STRINGSlot 12
    text13STRINGSlot 13
    text14STRINGSlot 14
    text15STRINGSlot 15
    text16STRINGSlot 16
    text17STRINGSlot 17
    text18STRINGSlot 18
    text19STRINGSlot 19
    text20STRINGSlot 20

    Outputs (3)

    NameTypeDescription
    textSTRING
    labelSTRING
    indexINT