Nodes/AUN ComfyUI Nodes/String List Index
ComfyUI Node

String List Index

The tiny selector that completes the string-list pair

By loz2754·Created 8 months ago·Updated a day ago· 5
String List Index
  • string_list
  • string
index1

This node does one thing and does it without fuss: it takes a AUN_STRING_LIST and an index, and hands you back the string at that position. It's the selector half of the AUN pack's string-list pair - the Builder compiles the list, this node picks from it. There's no randomness, no mode switching, no cleverness. Which, honestly, is exactly why it's useful.

What it does

Wire a string_list in from a String List Builder node, set index (1-based), and it outputs the chosen string. That's the entire contract. The index is clamped to the list length, so asking for index 5 in a 3-item list returns the 3rd item instead of throwing an error - the kind of small robustness that keeps a batch run from dying on an edge case. An empty or unconnected list just returns an empty string.

Inputs and outputs

  • string_list - the list, from a String List Builder (the tooltip says it plainly: "String list from a String List Builder node"). It's the custom AUN_STRING_LIST type, so it expects a Builder, not a plain text.
  • index - the 1-based position to select, default 1.
  • Output: string - the selected text.

How it works

Dead simple under the hood: it validates the list, clamps the index into range, and returns the element. One thing worth noting - if you feed it a list that's already a single string rather than a proper list, or the index logic gets confused, it degrades gracefully to an empty string rather than exploding mid-queue. That's the kind of defensive coding you don't notice until it saves you.

When to use it

Whenever you have a list of strings and a source of indices. The classic wiring: AUNRandomIndexSwitch or a counter → index here, AUNStringListBuilderstring_list, and string out to wherever it's needed. If you've built a list of prompt variants in the Builder, this is the node that lets a random/select integer pick one of them per run. Same pattern works for filenames, tag lists, or any set of alternatives you want to step through.

It's the right tool when you want the data and the selection logic separate. If you want it all in one node, the pack's Text Index Switch 4 or Random Text Index Switch V2 does switching plus index generation together - but those mix selection modes into the switch. This node's virtue is that it never surprises you: index in, string out, nothing else.

Installing

It's part of the AUN ComfyUI Nodes pack:

cd ComfyUI/custom_nodes
git clone https://github.com/loz2754/AUN-ComfyUI-Nodes

Restart ComfyUI, or install via ComfyUI Manager (search "AUN"). No models, no heavy dependencies - just the pack's standard requirements, handled by Manager or pip install -r custom_nodes/AUN-ComfyUI-Nodes/requirements.txt after a manual clone.

The one thing to remember: it's 1-based, like the rest of the pack's index nodes. Index 1 is the first string. It's a small detail, but it's the difference between "first prompt" and "second prompt," and it's the only way this node will ever trick you.

CategoryAUN Nodes/Text

Inputs (2)

NameTypeDefaultDescription
string_listAUN_STRING_LISTString list from a String List Builder node.
indexINT11-based index to select which string to output.

Outputs (1)

NameTypeDescription
stringSTRING