Nodes/CRT-Nodes/String Batcher (CRT)
ComfyUI Node

String Batcher (CRT)

Turn N prompt fragments into one batch-ready string

By PGCRT·Created 2 years ago·Updated 2 days ago· 132
String Batcher (CRT)
    • string_output
    consolidate_linestrue
    join_with
    suffix
    randomizefalse
    seed0
    save_to_filefalse
    file_pathSavedPrompts
    filename_prefixprompt

    Prompt batching is where ComfyUI stops feeling like a toy and starts feeling like a render farm, but the plumbing is awkward: how do you get a dozen different prompts into a sampler in one run? String Batcher (CRT) is the CRT pack's answer on the text side - it's a dynamic string-merging node that grows N inputs, cleans them up, and joins them into a single output that downstream batch nodes can chew on.

    Unlike the static Join Strings, this one is alive. A small widget on the node (backed by the pack's JavaScript) controls a batch_count, and the node adds or removes string_1, string_2, … inputs to match. Type in six fragments, set the count to six, and you've got six inputs without touching Python.

    The knobs that matter

    • consolidate_lines - collapses line breaks within each individual string input, so a multi-line fragment becomes one continuous phrase before it gets joined. Leave it on unless you're deliberately feeding structured text.
    • join_with - Newline or Space, which is how the processed fragments are joined on output. Newline is what you want if the result is feeding a prompt scheduler that treats lines as separate prompts.
    • suffix - appended to every fragment before joining. Handy for adding a shared quality tag or style token to each prompt in the batch.
    • randomize + seed - shuffles the fragments before joining. Seeded, so a given seed always gives the same order. Great for varying batch order without touching your source text.
    • save_to_file - writes each processed fragment to its own .txt in ComfyUI/output/<file_path>/, named <filename_prefix>_001.txt, _002.txt, and so on. This is a surprisingly useful escape hatch if you want to inspect or re-run individual prompts.

    Output is a single string_output string. The node's actual batching is on input - the output is one joined string, which is what conditioning schedulers and the pack's batch samplers expect.

    Where it fits

    The classic pattern: several prompt fragments → String Batcher (joined with newlines) → a scheduler that encodes each line into a conditioning batch → CRT's KSampler Batch rendering them all in one pass. It's also the natural step-up from Join Strings when you need more than two parts, and randomize makes it a lazy-man's prompt variation engine: seed controls the order, so you can sweep seeds and get different sequence orders for free.

    Install and gotchas

    Same pack, same drill:

    cd ComfyUI/custom_nodes
    git clone https://github.com/PGCRT/CRT-Nodes.git
    pip install -r requirements.txt
    

    Or ComfyUI Manager → search "CRT-Nodes". One real gotcha: save_to_file writes into the ComfyUI output directory (not your working dir), and file_path is relative to that - so SavedPrompts becomes ComfyUI/output/SavedPrompts/prompt_001.txt. It will happily overwrite _001.txt on re-run, so don't use this to archive generations. And if you enable randomize, remember the order you see in the output string is the shuffled order - that's the point, but it trips people up the first time they expect "1, 2, 3" back.

    CategoryCRT/Text

    Inputs (8)

    NameTypeDefaultDescription
    consolidate_linesBOOLEANtrueIf True, removes line breaks within each individual string input
    join_withCOMBO'Newline' for 'return to line' behavior between strings
    suffixSTRINGCharacter(s) to add to the end of each string before joining
    randomizeBOOLEANfalse
    seedINT00–18446744073709550000
    save_to_fileBOOLEANfalseEnable to save each processed string as a .txt file
    file_pathSTRINGSavedPromptsThe directory within the main output folder to save the .txt files to
    filename_prefixSTRINGpromptThe prefix for the saved filenames

    Outputs (1)

    NameTypeDescription
    string_outputSTRING