Nodes/ComfyUI Video BC/Text Batch Indexer
ComfyUI Node

Text Batch Indexer

Pulling one prompt out of the pile

By JioJe·Created about a year ago·Updated 5 months ago· 14
Text Batch Indexer
  • batch_texts
  • batch_filenames
  • text
  • filename
current_index0

ComfyUI's graph is genuinely bad at "give me item #7 of that list." Text Batch Indexer is the one-node answer: it takes a batch of text plus an index, and hands back exactly one string and its filename.

The mechanism is plain Python list indexing - batch[current_index] - nothing else. It's a tiny node with one job, which is exactly why it's useful. Out of range, or the lists are empty, and you get empty strings back rather than a hard crash. That's friendlier than it sounds when you're automating, because a scripted loop can keep running instead of dying on a short batch.

Inputs:

  • batch_texts (LIST) - wire this from Text Batch Loader, or anything else that emits a list of strings.
  • batch_filenames (LIST) - the aligned filename list, same batch. Wire it even if you only care about the text; the node reads from both lists at the same index.
  • current_index (INT, default 0, range 0–9999) - which item to pull. This is the widget you'll actually be touching.

Outputs: text (STRING) and filename (STRING), both single values.

The interesting part is that current_index can be converted to an input (right-click the widget → Convert to input), which is how you walk the batch programmatically. Feed it a counter or a loop iterator and the Indexer becomes the "current item" reader inside a per-item loop: load once, index many times. ComfyUI has no native for-loop, but the loop packs (ComfyUI-Loopback, Impact Pack's iteration nodes) all expect exactly this shape - a list in, one item out per pass. Or just set the number by hand and run; for a batch of twenty files that's perfectly fine.

One honest limitation: the widget caps at 9999. For real use that's a non-issue - nobody's loading ten thousand prompt files - but if you drive it from an external counter, stay under it.

Same install as the rest of the pack: Manager search "ComfyUI Video BC", or cd ComfyUI/custom_nodes && git clone https://github.com/JioJe/comfyui_video_BC and restart. Text-only, so no heavy dependencies and no models to download. If you find yourself reaching for this node a lot, the pair to learn is Loader → Indexer → a prompt encoder: that's the "process a folder of prompts one at a time" pattern that ComfyUI otherwise makes surprisingly awkward.

CategoryBC/Text

Inputs (3)

NameTypeDefaultDescription
batch_textsLIST
batch_filenamesLIST
current_indexINT00–9999

Outputs (2)

NameTypeDescription
textSTRING
filenameSTRING