Nodes/ComfyUI-Desert-Pixel-Nodes/DP 10 String Switch Or Connect
ComfyUI Node

DP 10 String Switch Or Connect

Ten prompt slots, switch, merge, or drop the negatives

By DesertPixelAi·Created 2 years ago·Updated about a year ago· 25
DP 10 String Switch Or Connect
    • TEXT
    • CURRENT_INDEX
    modeSwitch
    index1
    String_01
    String_02
    String_03
    String_04
    String_05
    String_06
    String_07
    String_08
    String_09
    String_10

    The maxed-out version of the Desert Pixel string switch. Ten text inputs, and the same two-jobs deal: pass exactly one through (switch), or concatenate all the connected ones (connect). Ten is a lot - you reach for this when you're managing a real library of prompt fragments, like a bank of ten style presets you cycle through, or ten scene beats you assemble into one long prompt.

    It's from DesertPixelAi's pack, a sprawling collection of quality-of-life nodes. None of them generate anything; they're plumbing, in the same spirit as rgthree's utilities. This is the biggest of the string switches, and it carries one extra trick the smaller ones don't.

    How it works

    mode sets the behavior and index selects the input in switch mode. What's different here is that mode has six options instead of five:

    • Switch - output only the string at index.
    • Connected - join all connected strings directly.
    • Connected with comma - join with , .
    • Connected with line break - one per line.
    • Connected with line break+ - line breaks with extra spacing.
    • Switch Remove neg - switch to one string, but strip out its negative portion.

    That last mode is the reason to know this node exists over the 5-input one. If you keep your fragments written with an embedded negative section, "Switch Remove neg" lets you pull just the positive part through - handy when a downstream node only wants the positive prompt. Test it against your own text format, since exactly what counts as "the negative part" depends on how you write it.

    The inputs and outputs that matter

    • mode - the six behaviors above.
    • index - integer 1 to 10, used only in the Switch modes.
    • String_01String_10 - ten optional multiline inputs. Fill only the ones you need.

    Outputs are TEXT (the result) and CURRENT_INDEX (integer). With ten slots, the index output really pays off: drive index from an incrementing seed or counter and you've got a ten-way prompt rotator that also tells you which entry it landed on.

    How to install it

    • ComfyUI Manager: search "Desert Pixel", install, restart. Nothing to download.
    • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/DesertPixelAi/ComfyUI-Desert-Pixel-Nodes, pip install -r requirements.txt if present, restart.

    Look under the DP category in the node menu.

    Common issues

    Ten inputs makes the empty-slot problem more likely, not less. In a Switch mode, an index pointing at an unfilled slot outputs an empty string - easy to do when you've only wired up four of the ten. If a switch comes out blank, that's the first thing to check.

    And as with its siblings, index does nothing in the Connected modes; every wired string is used there. If you meant to select just one and got all ten glued together, you left mode on a Connected option.

    CategoryDP/text

    Inputs (12)

    NameTypeDefaultDescription
    modeCOMBOSwitch6 options: Switch, Connected, Connected with comma, Connected with line break, Connected with line break+, Switch Remove neg
    indexINT11–10
    String_01optSTRING
    String_02optSTRING
    String_03optSTRING
    String_04optSTRING
    String_05optSTRING
    String_06optSTRING
    String_07optSTRING
    String_08optSTRING
    String_09optSTRING
    String_10optSTRING

    Outputs (2)

    NameTypeDescription
    TEXTSTRING
    CURRENT_INDEXINT