๐๐๐ ฐ๏ธ Line selector (๐ฒ or โป or โป๐)
Pick, random, or loop through lines of text
- text
- remaining_cycles
- current_line
Write a list of prompts, one per line, and this node pulls lines out of it - a specific one, a random one, or all of them in a loop. It's one of the pack's "universal" nodes: a single box that does manual pick, random draw, loop, and sequential loop depending on which toggle you flip. If you keep a text file of prompt ideas, this is how you feed them into a workflow without copy-pasting.
Why it's handy
Batch generation usually means "run these ten prompts." The clumsy way is ten prompt nodes; the clean way is one text field with ten lines and a selector that walks them. Line Selector is that selector. Paste your list, choose a mode, and it either hands you one line at a time (great for A/B'ing prompts), rolls a random line each run (great for variety), or loops the whole list. The author consolidated several older nodes into this one universal version precisely so you don't have to remember which node does which mode.
How it works
You put your list in text (multiline), one item per line. Then the mode toggles decide what comes out:
- line_number - pick a specific line by its number. Set it to
0and it draws a line at random instead. - RANDOM - force random selection.
- LOOP - loop over all lines (within a run).
- LOOP_SEQUENTIAL - advance one line per workflow run, rather than cycling inside a single run - good for stepping through a list across repeated executions.
- jump - the step size when looping.
- pick_random_variable - controls the variable-substitution behavior (below).
A genuinely useful detail: when it picks at random, it skips any line that starts with #. So you can comment out a prompt without deleting it - leave it in the file, prefix it with #, and it's ignored by the random draw. Small thing, saves you a scratch file.
There's also an optional variables input (multiline) and the <name> variable syntax the pack shares across its text nodes - so a selected line can reference variables defined elsewhere and have them substituted in, rather than being used literally.
The outputs: text (a list - the selected line, or all of them when looping), remaining_cycles (how many iterations are left, handy on a Show node to watch a loop drain), and current_line (which line index you're on right now).
Installing the pack
One pack: ComfyUI Manager โ Install Custom Nodes โ search Bjornulf_custom_nodes โ install โ restart, or
cd ComfyUI/custom_nodes
git clone https://github.com/justUmen/Bjornulf_custom_nodes
Restart and it's under Bjornulf. Pure text logic - no dependencies, works immediately.
Common issues
The commonest confusion is mode collision - turning on more than one of RANDOM / LOOP / LOOP_SEQUENTIAL at the same time and getting behavior you didn't expect. Pick one mode and leave the rest off. If you want a fixed line, set line_number to its number and leave RANDOM off; if you want random, either set line_number to 0 or flip RANDOM.
Second: this node has been reworked (the author rolled several older selectors into this "universal" one in a breaking change), so a very old workflow that referenced the previous nodes may need this one wired in fresh. Third, mind the list output - because text can be a list, downstream nodes run once per selected line when you're looping, which is the point but also multiplies your run count, so keep the chain after it lean. And remember the # trick for random mode: it's the clean way to park a prompt without losing it.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | โ | |
| line_number | INT | 00โ99999 | โ |
| RANDOM | BOOLEAN | false | โ |
| LOOP | BOOLEAN | false | โ |
| LOOP_SEQUENTIAL | BOOLEAN | false | โ |
| jump | INT | 11โ100 | โ |
| pick_random_variable | BOOLEAN | true | โ |
| variablesopt | STRING | โ |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| text | STRING | โ |
| remaining_cycles | INT | โ |
| current_line | INT | โ |