Nodes/ymc-node-suite-comfyui/get text in list (loop)
ComfyUI Node

get text in list (loop)

Turn one text field into a whole prompt queue

By YMC-GitHub·Created 3 years ago·Updated about a year ago· 20
get text in list (loop)
    • text
    • seed
    • index
    • count
    text
    seed0
    char|

    If you've ever sat in front of a KSampler thinking "I really should generate all ten outfits and pick the good one," this is the node that ends the manual typing. Get text in list (loop) takes one pipe-separated string, walks through it one item at a time as you change the seed, and hands you the current pick plus its index and count. It's a text picker built for batch iteration, and it's one of the more genuinely useful ideas in ymc's text suite.

    Here's the pattern that makes it click: feed it something like red|blue|green|yellow, drive its seed input from an incrementing counter node, and wire its text output into your prompt. Run the queue ten times and each run samples a different color. Because the selection is seed-driven rather than random, you get deterministic, reproducible iteration - the same seed always picks the same item, so you can revisit a run.

    How it works

    Under the hood it's embarrassingly simple, which is the point. The node splits your text on the char separator (default |), then computes index = (seed - 1) % length and returns that item. The seed is meant to be bumped by one each run: seed 1 gets item one, seed 2 gets item two, and when you run past the end it wraps back around to the start. That wraparound is the "loop" in the name.

    Two behaviors worth knowing:

    • The node declares IS_CHANGED as NaN, so ComfyUI re-executes it every run even if nothing visibly changed. Don't fight that; it's what makes queue iteration work.
    • The output index is the human-readable 1-based position ("1", "2", …) and count is the total number of items. Wire both into a Show Text node if you want to see where you are in the loop.

    Inputs and outputs

    The inputs are minimal:

    • text - your pipe-delimited list, e.g. cyberpunk city|medieval village|space station
    • seed - the loop position driver (0 to 2^64)
    • char - the separator, | by default; change it if your content contains pipes

    Outputs: text (the picked item), seed (echoed back), index (1-based position as a string), count (number of items). The text output is the one you'll actually use; the rest are for keeping your workflow legible.

    Installing it

    The pack installs like any custom node:

    # ComfyUI Manager: search "ymc suite" (pack: ymc-node-suite-comfyui) and hit Install
    # or manually:
    cd ComfyUI/custom_nodes
    git clone https://github.com/YMC-GitHub/ymc-node-suite-comfyui
    

    Then restart ComfyUI. The pack's only dependencies are four tiny pure-Python helpers on PyPI (yors_comfyui_node_setup, yors_pano_ansi_color, yors_pano_zero_field, yors_pano_list_util) that install themselves on first load. No model downloads, no GPU-weight dependencies.

    Gotchas

    • The README's registry install command (comfy node registry-install ymc-node-suite-comfyui) returns a 409 "Unclaimed" error - ignore it and use Manager or the git clone above.
    • If you also run WAS Node Suite, Manager will flag node-name conflicts (Image Save, Save Text File registered by both packs). It's cosmetic until a save node misbehaves, but the clean fix is to disable whichever pack you're not actually using.
    • The separator is a plain string split, so keep char distinct from anything in your list, and don't expect whitespace handling - split is literal.
    Categoryymc suite/text/plain

    Inputs (3)

    NameTypeDefaultDescription
    textSTRING
    seedINT00–18446744073709550000
    charSTRING|

    Outputs (4)

    NameTypeDescription
    textSTRING
    seedINT
    indexSTRING
    countINT