Nodes/Comfyui-TOO-Pack/Text Line Selector πŸ“‹
ComfyUI Node

Text Line Selector πŸ“‹

Slice a multiline block into a list, with a mini query language

By tetsuoo-onlineΒ·Created 9 months agoΒ·Updated about a month agoΒ· 5
Text Line Selector πŸ“‹
    • STRING
    • indexed
    • input_count
    • output_count
    • FLOAT
    • INT
    β—„promptβ–Ί
    β—„start_index0β–Ί
    β—„max_rows1000β–Ί
    β—„range_strβ–Ί

    Text Line Selector turns a big multiline block into a paginated list, which sounds dull until you realize it's the node that makes "one prompt per line" workflows actually usable. Paste a hundred lines of prompts, seeds, or LoRA names into prompt, and this node hands you back the lines you asked for as a list - the exact shape many samplers and batch nodes want.

    The default behavior is a simple window: start_index skips the first N lines, max_rows caps how many you get. If you have 1000 lines and want to process them in pages of 100, set max_rows to 100 and bump start_index as you go. But the real power is range_str, a tiny query language that takes priority whenever you fill it in:

    • 0-2 β†’ lines 0, 1, 2
    • 4--1 β†’ lines 4, 3, 2, 1, 0 (descending)
    • 1,4 β†’ just lines 1 and 4
    • -1 β†’ the last line; 2--1 β†’ line 2 through the end

    Negatives count from the end, exactly like Python slices. It's a compact way to cherry-pick from a prompt library or a LoRA list without writing a script.

    What comes out. Six outputs. STRING is the selected lines as a list; indexed is the same lines with their original index prefixed (12: line text), which is gold for knowing which line a result came from; input_count and output_count are the totals; and FLOAT / INT are numeric conversions of each line, defaulting to 1.0 / 1 when a line isn't a number. That numeric pair is the sneaky useful part - feed it a list of LoRA strengths or CFG values, and you get typed numbers out without a conversion step.

    Inputs and outputs. Required: prompt (multiline), start_index, max_rows, range_str. Non-empty lines only - blank lines are dropped before counting, so input_count counts content, not blank padding.

    Install.

    cd ComfyUI/custom_nodes
    git clone https://github.com/tetsuoo-online/Comfyui-TOO-Pack
    

    or ComfyUI Manager β†’ "Comfyui-TOO-Pack" β†’ restart.

    Where people trip. The range grammar is easy to misread: 4--1 is "four to minus one," not a typo - the double dash is range syntax with a negative end. And remember range_str silently overrides start_index/max_rows whenever it's non-empty, so if your carefully set window is being ignored, you left something in that box. For batch prompt work it's a genuine time-saver; for everything else it's a nice pagination helper.

    CategoryπŸ”΅TOO-Pack/utils

    Inputs (4)

    NameTypeDefaultDescription
    promptSTRINGβ€”
    start_indexINT00–9999β€”
    max_rowsINT10001–9999β€”
    range_strSTRINGRange selector (takes priority if filled). Dash for ranges: '0-2' (0,1,2), '4--1' (4,3,2,1,0). Comma for specific indices: '1,4' (1 and 4 only), '1,2,5' (1,2,5 only). Negatives supported: '-1' (last), '2--1' (2 to last)

    Outputs (6)

    NameTypeDescription
    STRINGSTRINGβ€”
    indexedSTRINGβ€”
    input_countINTβ€”
    output_countINTβ€”
    FLOATFLOATβ€”
    INTINTβ€”