ComfyUI Node

Load Text List

Pull batch prompts from numbered .txt files

By NMWave·Created 2 years ago·Updated 6 months ago· 6
Load Text List
    • STRING
    • FILENAME_STRING
    input_file_path
    file_name_integer0
    file_extension
    format_string{:04d}

    When you're running big batches, you often want your prompts to live in files rather than in the workflow - a folder of 0000.txt, 0001.txt, 0002.txt where each file holds one prompt, or a CSV of caption lines you generated with a tagger. Load Text List is the node that reaches into that folder, grabs the file matching an integer you pass in, and hands back its lines as a string list plus the filename as a bonus output.

    The design intent is pretty clear: drive a batch loop. You feed it an incrementing integer, it loads file N, you encode those lines as your prompt, and the loop moves on. The filename output lets you track which file produced which image without guessing.

    How it works

    Four inputs, two outputs:

    • input_file_path - the directory to read from. Important: the node constructs the path as input_file_path + "\" + filename, so you need to include the trailing separator yourself (C:\prompts\ style).
    • file_name_integer - which file to load, as a number.
    • file_extension - txt or csv.
    • format_string - how the integer becomes a filename. Default {:04d} zero-pads to four digits, so integer 7 loads 0007.txt. Want no padding? Use {}.

    Outputs: STRING - a list of the file's lines (this is the one with the list flag), and FILENAME_STRING - the constructed name like 0007.txt.

    Each line of the file becomes one element of the output list. That's it.

    Install

    Standard for this pack. ComfyUI Manager → search "Nader Tagging" → install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/NMWave/ComfyUI-Nader-Tagging
    

    No dependencies beyond ComfyUI's own, no model downloads.

    The gotchas, and they're real ones

    Two of them come straight out of the source, and they're worth knowing before you wire this into a batch rig:

    • The path join is Windows-only. The code hardcodes a backslash (input_file_path + "\\" + ...). On Linux or macOS that produces a literal backslash in the middle of a path and the file won't be found. If you're not on Windows, this node needs a path with backslashes anyway (or you'll want a different loader).
    • The "csv" mode isn't CSV. Both extensions are read identically - one line per list element, raw and unparsed. No column splitting, no header handling, no quote processing. If you point it at a real multi-column CSV, you get whole lines as strings, so treat it as "line list" and format your files accordingly.

    Two smaller quirks: the list items keep their trailing newlines (read lines include the \n), and the first output is a list while the second is a single string - a lot of display nodes expect one or the other, so check what you're wiring into.

    It's a simple, purpose-built batch-loading tool. On Windows with simple one-per-line files it just works; everywhere else, read the gotchas above first.

    CategoryNMWave/io

    Inputs (4)

    NameTypeDefaultDescription
    input_file_pathSTRING
    file_name_integerINT0
    file_extensionCOMBO2 options: txt, csv
    format_stringSTRING{:04d}

    Outputs (2)

    NameTypeDescription
    STRINGSTRING
    FILENAME_STRINGSTRING