ComfyUI Node

String Switch

Pick a prompt without rewiring your graph

By r-vage·Created about a year ago·Updated 5 months ago· 23
String Switch
    • string
    Input1
    input1
    input2

    You've got two text lines - a positive prompt and an alternate, a filename prefix and a backup - and you're tired of dragging a cable every time you want the other one. This is a two-position switch for STRING values, and that's the whole job: set the Input widget to 1 or 2, and whatever you wired into input1 or input2 comes out the string output. One small widget instead of re-plugging.

    The part people miss is the bypass behavior, and it's the actual reason this node exists. Read the README and you get the intended pattern: leave the node enabled with the standard value set to 2, then when you bypass the node (or a whole group that contains it), ComfyUI's core pass-through sends whatever is on input1 straight to the output. So input2 is your default and input1 is the alternate you reach by bypassing. In a workflow with a lot of groups that get toggled on and off - the author's own use case - that's a poor man's group muting, one switch at a time. Set it to 1 explicitly if you just want the node to always pass input1 while enabled.

    What you actually touch:

    • Input - the widget (1 or 2) that picks which socket passes through.
    • input1 / input2 - STRING sockets, and they're forceInput: you can't type into the node. Wire a multiline prompt box or another string node into each.

    Output is a single string socket; feed it anywhere a STRING is accepted - a CLIPTextEncode, a filename prefix, whatever. That's the whole node, no hidden magic.

    Installing it

    Install the pack once and you get every RvTools node. ComfyUI Manager → Install Custom Nodes → search ComfyUI-RvTools_v2, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/r-vage/ComfyUI-RvTools_v2
    

    Then restart ComfyUI. No model downloads, no keys. The dependencies (torch, numpy, Pillow, opencv-python, pilgram) are already in any normal ComfyUI install.

    Fair warning: this pack is unmaintained. The README says so and points at ComfyUI_Eclipse as the successor. It still works fine; Eclipse is just where the author's attention went. There's also history: RvTools v1 had a messy run - its repo vanished at one point, which stranded a lot of workflows - so v2 renamed every node with the [RvTools] suffix. That suffix is the fix, not decoration.

    Common issues

    • Nothing to type in. The inputs are forced sockets; beginners expect a text field and find an empty node. Wire a text node into each input.
    • Bypass vs. mute. Bypass forwards input1; mute silences the node entirely and downstream gets nothing. If you "switch" and the prompt disappears, you muted instead of bypassed.
    • No validation. If the selected input isn't connected, you get None down the wire, which some nodes choke on. Keep both inputs wired even if one is a stub.
    Category🫦 RvTools II/ Switches

    Inputs (3)

    NameTypeDefaultDescription
    InputINT11–2
    input1optSTRING
    input2optSTRING

    Outputs (1)

    NameTypeDescription
    stringSTRING