Nodes/comfyui-AGSoft/AGSoft Text Input Switch X4
ComfyUI Node

AGSoft Text Input Switch X4

Four prompts, one selector — branch without building a tree

By Art-xmaster·Created 12 months ago·Updated a day ago· 23
AGSoft Text Input Switch X4
    • STRING
    text1
    text2
    text3
    text4
    input_selector1

    The moment you need more than two prompt options, the binary-switch tree starts looking ridiculous: X2 feeding X2 feeding X2, three layers deep, for four options. AGSoft Text Input Switch X4 collapses that to one node. Four multiline text fields, one integer selector (1–4), one output. Pick a number, get that text. It's the pack's mid-size branching node, and it's the one you reach for when a workflow has "four moods" or "four subjects" rather than a simple either/or.

    How it works

    Inputs text1text4 (all multiline, all wireable) plus input_selector, an INT bounded 1–4 (default 1). The output is the selected string, passed through unchanged. Same core design as the X2: an integer index into the field list, no dropdown, no type juggling.

    The integer selector is the interesting bit. Because it's a number, it can be driven - a loop counter or batch index can step it 1→2→3→4, which means one X4 switch becomes a four-way prompt selector that automatically rotates through your options per batch item. That's the pattern most people actually want from this node: not a manual four-position dial, but a slot machine fed by upstream logic.

    When X4 beats the alternatives

    • More than two options, all known in advance → X4 beats a tree of X2s.
    • Text-only routing → X4 beats the pack's Switch Any, which is overkill (and widgty) when everything is strings.
    • Fewer than four in use → just leave extra fields empty; the switch will happily output an empty string if you select one, so keep your selector in range.

    Installing

    cd ComfyUI/custom_nodes
    git clone https://github.com/Art-xmaster/comfyui-AGSoft
    

    Restart, or ComfyUI Manager → "comfyui-AGSoft". No models.

    Watch the same clamping behavior as the X2: the selector is hard-bounded 1–4, so a 0 or 5 from upstream logic clamps to the edge rather than erroring. That's usually benign, but if your loop drives it with a 1-based counter it lines up perfectly with the field numbering - the pack's Loop Integer node (start at 1) is a natural driver here.

    CategoryAGSoft/Text

    Inputs (5)

    NameTypeDefaultDescription
    text1STRINGThe first text option. Первый текстовый вариант.
    text2STRINGThe second text option. Второй текстовый вариант.
    text3STRINGThe third text option. Третий текстовый вариант.
    text4STRINGThe fourth text option. Четвертый текстовый вариант.
    input_selectorINT11–4Select which input text to output (1-4). Выберите, какой входной текст выводить (1-4).

    Outputs (1)

    NameTypeDescription
    STRINGSTRING