π Text Selector
Pick one line out of a text block β your poor-man's prompt randomizer
- STRING
You have a list. You want one item out of it, chosen by a number. That's the whole node, and it's quietly one of the more useful things in the Ace Nodes pack because it's the missing primitive for prompt variation workflows. Instead of building twenty separate prompt branches, you paste twenty prompt lines into one text box and drive them with a single integer.
It's part of π
Ace Nodes (hay86/ComfyUI_AceNodes), a one-author utility grab-bag. Nothing fancy, no models, no network - just string handling.
How it works
list_text is a multiline field. The node splits it on newlines, strips whitespace, and drops empty lines. Then select (an integer, default 0) picks the line at that index. The output is a single STRING.
Two details that matter:
- Indexing is 0-based.
select = 0is the first line, not the second. If you came from a 1-based mindset, this will surprise you exactly once, at the worst possible moment. - It clamps, it doesn't wrap. The index is clamped into range, so
select = 999gives you the last line andselect = -5gives you the first. If you were hoping for modular cycling (line 4 with a 4-line list wrapping back to line 1), that's not what happens. For looping variations, driveselectfrom a counter that resets, not an ever-increasing seed.
Why you'll reach for it
The classic build: a big block of negative prompts, one per line, selected by a seed-driven integer - every generation in a batch tries a different negative, which is a legitimate way to survey what your checkpoint struggles with. Or subject lists: portrait, landscape, still life per line, and a seed picks which one this run generates. Pair it with this pack's ACE_TextList (which splits a block into a list for batch processing) if you need the whole list rather than one item - TextSelector is the "one at a time" sibling.
Where people get tripped: forgetting the input is newline-separated, so pasting comma-separated text in gives you one giant line and the selector does nothing visible. If your output isn't changing, check you actually used line breaks.
Installing
ComfyUI Manager β search ComfyUI_AceNodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/hay86/ComfyUI_AceNodes
Then restart. Installing the pack pulls its whole requirements.txt (transformers, rembg, insightface, soundfile, the usual), but this node itself uses only core Python - no extra load at runtime.
Honestly, any text-selection node from any utility pack does this job. This one is fine, free, and does exactly what it says with zero surprises beyond the 0-based index. If you already have a prompt-batching setup, check whether it has a "pick line N" node before adding this pack - if it doesn't, this is the cleanest way to get it.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| list_text | STRING | β | |
| select | INT | 0 | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | β |