Nodes/ComfyUI-Flow-Assistor/Prompt Queue (From Folder)
ComfyUI Node

Prompt Queue (From Folder)

Batch-generate from a folder of prompt files, and know which one ran

By Merserk·Created 9 months ago·Updated about a month ago· 6
Prompt Queue (From Folder)
    • prompt_text
    • filename
    folder_pathC:/Prompts
    extensionstxt, json
    on_endempty
    reset_trigger0

    Prompt Queue (From Folder) is the sibling of the pack's plain Prompt Queue, and it's the one you want when your prompt list lives in files instead of a text box. It reads .txt or .json files from a folder one at a time, in deterministic filename order, and outputs both the file's content and its name. The filename output is the feature - when you batch-generate 40 scenes, you can save each image with the prompt file's name baked in, so matching output to prompt is instant instead of a forensic exercise.

    How it works

    Same stateful trick as the base Prompt Queue: the node keeps a pointer in a per-node store, hands back the current file, then advances on every execution. Two differences matter.

    First, it re-scans the folder - if you add, remove, or modify files while the node sits in the graph, the next run picks up the new list and restarts from the top. That's deliberate, and it means you can prep a folder without ever touching the node again.

    Second, the ordering is by filename (case-sensitive string sort, per the source). Name your files 01_scene.txt, 02_scene.txt … if you care about order; 10_ sorts before 9_, the classic lexicographic gotcha.

    The inputs:

    • folder_path - where the prompt files live. Default is C:/Prompts, which tells you the author's on Windows; use forward slashes or an absolute path and it works fine elsewhere.
    • extensions - comma-separated filter, default txt, json. Files are read as UTF-8 text.
    • on_end - empty (returns a blank prompt and filename end_of_list), loop, or hold_last (keeps repeating the final file). Note there's no repeat_last here like the base queue; hold_last is the equivalent.
    • reset_trigger - bump it to jump back to the first file.

    Outputs are prompt_text (STRING) and filename (STRING). The classic wiring is prompt_text into CLIP Text Encode and filename into a save-node filename field - or use the pack's Show Text node to eyeball what's being read while you debug.

    Installing

    This is one of the 26 nodes in ComfyUI-Flow-Assistor - ComfyUI Manager (search "Flow Assistor") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Merserk/ComfyUI-Flow-Assistor.git
    

    Restart after cloning. Current ComfyUI required (the pack is V3-only), no extra Python dependencies, no model files.

    Where people get burned

    The biggest surprise is the automatic re-scan: drop a file into the folder mid-batch and the queue silently resets to the top, so you'll re-render scenes you already did. The node logs a Folder scanned: N files found line to the console when that happens, but only if you're watching. Second: nonexistent folder paths return an empty result (no_files_found) instead of erroring loudly - harmless, but confusing if you typo the path and wonder why nothing renders. And remember the queue advances every execution: running the graph once to test a single file moves the pointer, so either reset the trigger or reconnect the file you care about to a plain loader.

    Categoryflow-assistor/text

    Inputs (4)

    NameTypeDefaultDescription
    folder_pathSTRINGC:/Prompts
    extensionsoptSTRINGtxt, json
    on_endoptCOMBOempty3 options: empty, loop, hold_last
    reset_triggeroptINT00–2147483647

    Outputs (2)

    NameTypeDescription
    prompt_textSTRING
    filenameSTRING