Nodes/ComfyUI_BishaNodes/Create Prompts With Text From File
ComfyUI Node

Create Prompts With Text From File

Turn a plain text file into a whole batch of prompts

By vladpro3·Created about a year ago·Updated 5 months ago· 0
Create Prompts With Text From File
    • prompts
    file_path
    next_linefixed
    start_line0
    results1
    prepend_text
    append_text

    If you've ever wanted to generate "a portrait of X" across fifty different names without rebuilding the workflow fifty times, this is the node. CreatePromptsWithTextFromFile reads a plain .txt file - one prompt per line - and turns it into a list of prompt strings, optionally wrapped in text you prepend and append. It's the "batch prompt" building block, and it's the workhorse of this pack's prompt side.

    The workflow it's built for: you have a file of character names, artists, styles, or descriptors, and a fixed prompt skeleton around them. Put the skeleton in prepend_text and append_text, point file_path at your list, and the node produces one finished prompt per line. You then feed that list into whatever encodes text in your graph. If you're on a setup where CLIPTextEncode won't swallow a list directly, run it through a node that unrolls lists or handles batched prompting - the output is explicitly a list (OUTPUT_IS_LIST), which is the hint that it's designed to drive multiple generations.

    How it picks lines is where the personality is. The next_line dropdown gives you four modes: increment, decrement, random, and fixed. Increment walks the file forward each run, decrement backward, fixed stays on the line set by start_line, and random jumps around. results controls how many prompts come out. Two details worth knowing: if results is larger than the file in increment/decrement mode, it quietly clamps down to the file length rather than repeating; and the node marks itself as always-changed (IS_CHANGED returns NaN), so it re-runs on every queue instead of caching - which is exactly what you want for random to keep re-rolling, but it does mean the node never skips a run.

    The inputs you'll actually touch:

    • file_path - absolute or $ENV_VAR-expanded path to your .txt file (one entry per line, blank lines skipped).
    • results - how many prompts to emit.
    • next_line - increment / decrement / random / fixed.
    • prepend_text, append_text - optional fixed text wrapped around each line, joined with a comma.

    Output is a single prompts output: a STRING list.

    One thing the file reader does that's easy to miss: it inserts a space before any < in a line. That's deliberate, so tokens like <lora:...> don't glom onto the preceding word when they land in your prompt.

    Gotchas, from reading the source: an empty or missing path doesn't raise - it just yields empty strings, so a typo in file_path gives you blank prompts, not an error. A non-empty path to a nonexistent file does raise FileNotFoundError, which is the louder, more helpful failure. Files are read as plain UTF-8 text. Install the pack once via Custom Nodes Manager (search ComfyUI_BishaNodes) or git clone https://github.com/vladpro3/ComfyUI_BishaNodes.git into custom_nodes, restart, and you're set - no models, no dependencies, MIT-licensed.

    The name is honest: it makes prompts from a text file, full stop. If you want the same line-picking logic but with values swapped into a {placeholder} inside the prompt itself, that's the sibling Wildcard Replace nodes - and if your value pool lives in multiple toggleable files, Load Data From Files feeds those directly.

    CategoryBishaNodes/prompt

    Inputs (6)

    NameTypeDefaultDescription
    file_pathSTRING
    next_lineCOMBOfixed4 options: increment, decrement, random, fixed
    start_lineINT0
    resultsINT1
    prepend_textoptSTRING
    append_textoptSTRING

    Outputs (1)

    NameTypeDescription
    promptsSTRING