Text Line Selector π
Slice a multiline block into a list, with a mini query language
- STRING
- indexed
- input_count
- output_count
- FLOAT
- INT
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, 24--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.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | β | |
| start_index | INT | 00β9999 | β |
| max_rows | INT | 10001β9999 | β |
| range_str | STRING | Range 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)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | β |
| indexed | STRING | β |
| input_count | INT | β |
| output_count | INT | β |
| FLOAT | FLOAT | β |
| INT | INT | β |