Load Sequenced Txt File Tlant
Step Through Prompts in Order
- text
- txt_file_path
- txt_filename
The name says "Sequenced" and that's exactly the point: this node is the ordered sibling of the random loaders in the Tlant pack. Instead of rolling the dice, it sorts every .txt file in a folder by filename and serves them one at a time as you bump an index. If you're batching out variations and want prompts 01, 02, 03 to fire in a known order - or you're pairing each prompt file with a specific image and need the pairing to hold - this beats the random versions.
How it works
It scans dir_path (recursively if is_recursive is "true"), collects every .txt, sorts the full paths ascending, and then uses your txt_index to pick one with modulo math: selected_index = txt_index % len(txt_files). That's the clever bit - the index wraps around, so you can drive the counter from anything (an animation frame, a for-loop, a slider) and never run off the end of the list. Index 0 gets the alphabetically-first file, and once you pass the last one it loops back to the start.
Reading uses the usual utf-8 → gbk → latin-1 fallback chain, and it's one of the friendlier members of the family: three outputs, including both the full path and the bare filename.
Inputs and outputs
dir_path- absolute folder path.txt_index- the counter. Default 0, min 0, effectively unbounded because of the modulo wrap.is_recursive-"true"/"false"enum, default"false".
Outputs: text (file contents), txt_file_path (full path of the selected file), and txt_filename (just the filename, no directory - handy for logging or naming outputs after the prompt that made them).
Install
One pack install covers all sixteen nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/Tlant/ComfyUI-OllamaPromptsGeneratorTlant
restart, done. Or find "Load Sequenced Txt File Tlant" in ComfyUI Manager.
Where people get tripped up
- Order depends on filename, not creation time. "Sequenced" here means alphabetical sort. If your files are
prompt1.txt, prompt10.txt, prompt2.txtyou'll get 1, 10, 2 - zero-pad your filenames (prompt01.txt) if you care about numeric order. - Same error-as-output trap as the rest of the family. Bad directory or no
.txtfiles → the error message lands intext, not in the console. - One caveat on "loops": the modulo wrap is per-execution, not a remembered position. Drive
txt_indexfrom something external that counts up; the node itself doesn't track where you are.
It's the load-order control the random loaders deliberately don't give you. When you need deterministic order instead of a dice roll, this is the one.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| dir_path | STRING | — | |
| txt_index | INT | 00–18446744073709550000 | — |
| is_recursive | COMBO | false | 2 options: true, false |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| txt_file_path | STRING | — |
| txt_filename | STRING | — |