Nodes/ComfyUI-iTools/Line Loader
ComfyUI Node

Line Loader

Pick one line out of a pasted list by index

By MohammadAboulEla·Created 2 years ago·Updated 7 days ago· 236
Line Loader
    • line loaded
    • count
    linescat dog bunny
    seed0

    Paste a list of words or short phrases, one per line, directly into this node - no external file needed - and it returns whichever line you index to. It's the inline sibling of Prompt Loader, which does the same job but reads from an external .txt file instead of a widget you type into directly. Use this one when the list is short enough to just live in the node, and Prompt Loader when you're managing something bigger externally.

    How it works

    lines is a multiline text widget - the shipped default is literally cat\ndog\nbunny, three lines to show the shape. seed picks which line comes back, indexed from zero. The pack's README pairs this node explicitly with its (separate, not covered here) Text Replacer node: paste your candidate words into Line Loader, cycle or randomize the index, and feed the result into Text Replacer to swap a placeholder in a larger template - a cheap way to get real prompt variation out of a small hand-written list rather than writing full alternate prompts by hand.

    The inputs and outputs that matter

    • lines - multiline text, one entry per line.
    • seed - 0 to 4095, the line index. Set this to increment or randomize (right-click the widget) to step through your list run to run instead of always returning the same line.

    Outputs: line loaded - the STRING for that index - and count, the total number of lines currently in the box. The README specifically calls out count as usable as a batch counter, since it tells you exactly how many variations exist without you counting them yourself.

    Installing it

    Via ComfyUI Manager: search "iTools" or "ComfyUI-iTools," install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MohammadAboulEla/ComfyUI-iTools
    

    then restart. Nothing extra required - this node reads only from its own text widget.

    Troubleshooting

    Same line comes back every run. If seed is fixed and the text hasn't changed, ComfyUI's caching will also just reuse the cached result rather than re-evaluating - set the seed widget to randomize or increment if you actually want a different line each queue.

    Index seems off by one. Counting starts at zero, same convention as Prompt Loader - the first line is index 0, not 1. Easy to trip on if you're used to 1-based line numbers from a text editor's gutter.

    Blank result on an index you expected to have content. If your list has trailing blank lines (a stray newline at the end after pasting), the last indices can resolve to empty strings rather than erroring - check the raw content of the lines box for accidental blank entries at the bottom.

    You've outgrown pasting text directly into the node. Once your list gets long enough that scrolling a widget is annoying, or you want to reuse the same list across multiple workflows, move it into an external file and switch to Prompt Loader instead - same indexing behavior, but backed by a file you can edit outside ComfyUI and share between graphs.

    CategoryiTools

    Inputs (2)

    NameTypeDefaultDescription
    linesSTRINGcat dog bunny
    seedINT00–4095

    Outputs (2)

    NameTypeDescription
    line loadedSTRING
    countINT