Get Text From List by Index JNK
Pull one item out of a list of strings
- text_list_l
- STRING
When a node hands you a list of strings and you only want one of them, Get Text From List by Index is the extraction tool. Feed it a list and an index, and it returns the item at that position as a single STRING. It's the text-world equivalent of "give me frame 5 of that batch" - except for prompts, filenames, tags, or whatever else your graph produces in bulk.
The JNK pack is built around lists in a few places - Image Filter Loader returns a list of paths, Split String and Join Strings produce and consume sequences - and this node is how you reach into those sequences and grab a specific entry for targeted processing. Say you batch-load a folder of images with their paths, then want to route path number three somewhere specific. Index node, done.
Inputs and outputs
index- zero-based position (default 0).text_list_s- a ComfyUI list of STRINGs (the node is markedINPUT_IS_LIST, so it accepts a list into this slot).text_list_l- the same thing from a node that outputs the genericLISTtype.
Only one of the two list inputs should be wired; if both are, text_list_s wins. Output is a single STRING.
How it works
The implementation flattens nested lists recursively, so [["a","b"],["c"]] is treated as ["a","b","c"] - you can't index into a sub-list directly, it just unwraps everything into one flat sequence. If the index is out of range, you get an empty string rather than an error, which is the one behavior you'll want to remember.
Installing it
Pack install: search JNK in ComfyUI Manager, or
cd ComfyUI/custom_nodes/
git clone https://github.com/Aljnk/ComfyUI-JNK-Tiny-Nodes.git
No dependencies beyond core.
Where people get burned
Two classic mistakes. First, feeding it a single string instead of a list - the node expects the STRING slot to carry a list (that's what INPUT_IS_LIST means), and wiring a plain text node there can behave unexpectedly. Wire it to a node that genuinely outputs lists, like the pack's Split String or a batch text node. Second, trusting an out-of-range index: past the end of the list you get "" with no warning, which then flows downstream and can look like a legitimately empty prompt. If your workflow starts producing blank outputs, check the index against the list length first. Otherwise it's about as straightforward as a node gets - index in, item out.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| index | INT | 0 | β |
| text_list_sopt | STRING | β | |
| text_list_lopt | LIST | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | β |