Text Split Counter
Count how many items are in your batch list
- count
- status
Text Split Counter answers one question: how many items are in this list? Give it a block of text - or a text file - and a separator, and it tells you how many pieces it splits into. That's it. It's the "how long is my batch" node for aidec's text-batch pack.
Sounds trivial, and mechanically it is. But it's genuinely useful as a companion to the queue nodes, because those nodes walk a list without you necessarily knowing up front how long the list is. Wire Text Split Counter to the same text and now you've got the total as a number you can use - to set a loop cap, to feed a progress readout, or just to sanity-check that your file actually parsed into the 340 prompts you think it has and not one giant blob because the separator was wrong.
How it works
It reads your text from wherever you point it, splits on the separator, and counts the resulting chunks. No state, no counter that advances, no re-queuing - unlike the queue processors, this one just looks at the whole list and reports its length in a single pass. Which also makes it the fastest way to verify your split before you commit to a long batch run.
The inputs that matter
- input_mode -
fileortext. Note the default here isfile, so if you're typing into the box, switch it totextfirst. This trips people up. - text_file - the path, in file mode.
- input_text - the box, in text mode.
- separator_type / separator - how the list is divided.
newlinefor one item per line, orcustomwithseparatorset to whatever your file actually uses (the pack defaults this to---for multi-line blocks). This has to match how your batch nodes are splitting, or the count won't agree with reality.
Outputs are just count (the number of items) and status. Feed count into anything that wants your batch length - Image Queue Processor Plus's max_index, a text overlay, a comparison node.
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
- Separator mismatch is the whole ballgame. If Text Split Counter says "1" and you expected 50, your separator doesn't match your file. Newline-separated file but the node's set to split on
---? One chunk. Get this node agreeing with your actual batch nodes before you trust the number - that's precisely what it's good for. - Default is file mode. If you paste prompts into
input_textbut leaveinput_modeonfile, it'll try to read a path called "Enter your text here..." and give you nonsense. Flip totextmode. - File paths are server-side. On a hosted ComfyUI the file has to live on the server, not your local disk.
It's a checking tool more than a building tool. Use it to confirm your list is the length you think, then let the queue nodes do the actual walking.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| input_mode | COMBO | file | 2 options: file, text |
| text_file | STRING | Enter the path to your text file here | — |
| input_text | STRING | Enter your text here... | — |
| separator_type | COMBO | newline | 2 options: newline, custom |
| separator | STRING | --- | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| count | INT | — |
| status | STRING | — |