ComfyUI Node

Text Array Index

Pull item N out of a list, across several lists at once

By aidec·Created 2 years ago·Updated 9 months ago· 19
Text Array Index
  • array_1
  • array_2
  • array_3
  • array_4
  • array_5
  • text
  • total
  • status
index0

Text Array Index is a "give me item N" node with a twist: it can index into up to five lists at once, all with the same index. Think of it as reaching into several parallel arrays - prompts here, filenames there, seeds in a third - and pulling the matching entry from each in a single pull.

In aidec's batch pack this is scaffolding for building your own loops. The queue nodes advance an index for you; something like this is what you'd wire that index into when your per-item data lives in arrays rather than a plain text block. It's honest to say it's one of the pack's rougher, more experimental nodes - the author flags most of the extras as test nodes - so treat it as a flexible primitive you assemble things from, not a polished, self-explanatory tool.

How it works

You hand it an index and one or more arrays; it returns the element sitting at that index. The arrays come in as the wildcard * type, so it's deliberately loose about what it's indexing - text lists, or other array-shaped data from elsewhere in the pack. With multiple arrays wired in, one index selects across all of them in parallel, which is the point: keep several related lists in lockstep as a loop counter climbs.

The inputs that matter

  • index - the position to pull (0-based). Drive this from a queue node's current_index to march through the arrays as a batch runs.
  • array_1array_5 (all optional) - the lists to index into. Wire in as many as you need; leave the rest empty. They accept the wildcard type, so they'll take array-shaped outputs from other nodes.

Outputs are lean: text (the element at that index), total (the array length), and status. The total is worth grabbing as a loop bound so you know when you've reached the end.

Installing it

cd ComfyUI/custom_nodes && git clone https://github.com/aidec/Comfyui_TextBatch_aidec, then restart ComfyUI (or ComfyUI Manager → Install via Git URL). No models, no heavy dependencies. Category: TextBatch.

Where people get burned

  • It's experimental. The pack's README is candid that the extra nodes beyond the documented queue/loader set are test pieces. Expect thin error handling and figure things out by trying, not by reading docs - there basically aren't any for this one.
  • Wildcard inputs cut both ways. Because the arrays accept *, ComfyUI won't stop you wiring in something that isn't really an indexable list. If the output looks wrong, check that what you fed in is actually array-shaped.
  • Index out of range. Ask for an element past the end of the shortest array and you're in undefined-behavior territory - keep the index bounded by total.
  • Single string output. It emits text, so it's built for pulling string-ish elements. If you need to keep image or other typed data in lockstep across a loop, look at the Data Temp nodes or Loop Result Extractor instead.

Useful if you're hand-rolling a loop over parallel lists. Overkill if you just need one prompt at a time - the queue processors already do that.

CategoryTextBatch

Inputs (6)

NameTypeDefaultDescription
indexINT00–10000
array_1opt*
array_2opt*
array_3opt*
array_4opt*
array_5opt*

Outputs (3)

NameTypeDescription
textSTRING
totalINT
statusSTRING