Nodes/ComfyUI-Text-Utility/Strings from textbox
ComfyUI Node

Strings from textbox

Pull one line at a time out of a textbox

By watarika·Created 2 years ago·Updated 10 months ago· 3
Strings from textbox
    • prompt
    • line_counter
    • total_counter
    text
    start1
    modeFixed
    repeats_per_line1
    counter0

    This is the no-frills batch stepper: paste a list of strings - prompts, filenames, anything - one per line, and each queue run outputs the next line. It's Automatic1111's "Prompts from file or textbox" workflow minus the wildcard engine, and that absence is exactly why you'd pick it over the pack's "Prompts from textbox" node: when your lines are plain text, you don't want the wildcard machinery, its Impact Pack dependency, or its seed input cluttering the graph.

    It's also the foundation the wildcard version is built on - same line-extraction logic, same hidden counter, same outputs. Learn this one and the other is free.

    How it works

    A small JavaScript extension drives the whole thing. It hides the counter widget and bumps it on every promptQueued event, so consecutive queue hits step through the lines automatically without you touching anything. The Python side then computes which line to serve: in Fixed mode, line = start + counter - 1 (counter is internal - you can't meaningfully set it); in Continued mode, the start widget itself increments as runs progress, so the position survives across queue sessions. repeats_per_line holds on a line for N runs before stepping.

    Inputs that matter

    • text (STRING, multiline) - your line list.
    • start (INT, default 1) - the first line to read.
    • mode - Fixed vs Continued. The tooltip is the author's own description: "If Fixed, start is left unchanged; if Continued, start is updated to the number at which the process has progressed."
    • repeats_per_line (INT, default 1) - how many runs each line gets.
    • counter (INT) - internal, owned by the JS, ignored if you set it by hand.

    Outputs

    • prompt (STRING) - the current line, ready for a text encoder.
    • line_counter (STRING) and total_counter (STRING) - both strings, not ints. Fine for display; convert if a numeric node needs them.

    The workflow

    Ten prompts in the box → set the queue batch to 10 → queue once → ten images, one prompt each, no editing in between. Wire prompt into your CLIP Text Encode and forget about it.

    Gotchas

    • No wildcards here. If a line contains __something__, it stays literal - that's the entire difference from "Prompts from textbox", which runs Impact Pack's wildcard processing on each line.
    • Queue more runs than there are lines and you get empty strings, not an error. Keep batch count ≤ line count, or you'll silently generate blank prompts.
    • Continued mode mutates start in the saved workflow. Usually that's what you want (resume mid-batch); just be deliberate about which mode you leave the workflow in when you save it.
    • One line per queue run - sampler batch_size doesn't step the list.

    Installing

    Ships with watarika/ComfyUI-Text-Utility. ComfyUI Manager → search "ComfyUI-Text-Utility" → Install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/watarika/ComfyUI-Text-Utility
    

    No pip requirements, no models, no Impact Pack needed for this one - the JS counter and the Python line-splitter are fully self-contained.

    Categorytext

    Inputs (5)

    NameTypeDefaultDescription
    textSTRING
    startINT1
    modeCOMBOFixedIf Fixed, start is left unchanged; if Continued, start is updated to the number at which the process has progressed.
    repeats_per_lineINT1
    counterINT0

    Outputs (3)

    NameTypeDescription
    promptSTRING
    line_counterSTRING
    total_counterSTRING