Nodes/ComfyUI Impact Pack/Text Wildcard Source / Modes
ComfyUI Node Runs on cloud

Text Wildcard Source / Modes

Prompt Presets From a .txt File, Walked By the Seed

By ltdrdata·Created 4 years ago·Updated about 15 hours ago· 3,396
Text Wildcard Source / Modes
    • text
    • name
    ◄category▾►
    ◄text_wildcard▾►
    ◄mode▾►
    ◄seed0►

    Impact Pack has quietly owned wildcard prompts in ComfyUI for years - __wildcard__ substitution, {a|b|c} alternation, LoRA tags inside prompts. TextWildcardSource is the plain-text sibling of that machinery and much simpler: it reads a .txt file full of prompt lines and hands you one of them. Not a random substitution engine - a preset picker. Fixed line, random line, the next line each run, or all of them at once.

    Why it's more useful than it sounds

    Because "a list of one-line prompts in a text file" is the shape most tests actually have. Twelve lighting setups. Eight camera framings. A pile of species descriptions for a character sheet. You want to run the same graph once per line with everything else held constant, and you do not want to build twelve prompt boxes or trust a random wildcard to hit every line.

    That's what the modes are for. sequential walks the file using the seed as an index, so with the seed's control_after_generate set to increment you get one new line per queue - a contact sheet of your whole list from one graph. batch short-circuits the whole thing and outputs every line as a list, letting ComfyUI's list handling run the rest of the graph once per item. random picks deterministically from the seed, so a seed is still a reproducible experiment. fixed just gives you the line you selected, which is the "I'm building this list up" mode.

    The inputs

    • category - the .txt files found in your configured wildcard directory. Each top-level .txt file is a category, named by its filename without the extension.
    • text_wildcard - the lines of that file, shown as dropdown labels. Long lines get truncated in the label (the full text is what's output), and duplicate labels get a (1), (2) suffix so they stay distinct. Changing category refreshes this list.
    • mode - fixed, random, sequential or batch.
    • seed - INT. Used by sequential (line number = seed mod line count) and random. fixed and batch ignore it, which surprises people who expect the seed to shuffle a batch.

    Outputs are both STRING and both lists:

    • text - the line, exactly as written.
    • name - the dropdown label of the line, which is a surprisingly handy filename prefix when you're saving a run per preset.

    The bit that trips everybody

    The text output does not process wildcard syntax. A line containing __color__ or {red|blue} comes out with the literal characters. That's deliberate - it's a source node, not a processor - and the fix is one wire: feed text into the populated_text input of ImpactWildcardProcessor (or ImpactWildcardEncode if your lines carry <lora:...> tags). Then the wildcard engine resolves it as normal. Chaining two of these into a StringConcatenate, one for scene and one for subject, gives you independent preset lists for separate parts of a prompt - the pack's own docs suggest exactly that.

    The other gotcha is where the files live. They go in the directory set by custom_wildcards in impact-pack.ini, which the pack writes on first run - typically ComfyUI-Impact-Pack/custom_wildcards, and you can point it anywhere from that ini. Files outside that directory can't be reached through category; the node resolves and checks the path rather than trusting what it's given, so a path-traversal trick won't help you and neither will a symlink. If you drop a new .txt in and it doesn't appear, re-add the node or reload - the category list is built when the node's definition loads, not on every run. And if the text_wildcard dropdown is showing something like (styles.txt not found), that's the pack telling you the file isn't where the config says it is.

    Install

    Part of Impact Pack - Impact Pack/Wildcard in the add-node menu.

    cd ComfyUI/custom_nodes
    git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack
    cd ComfyUI-Impact-Pack
    pip install -r requirements.txt
    

    Windows portable: ..\..\..\python_embeded\python.exe -m pip install -r requirements.txt, then restart. Manager users: search ComfyUI Impact Pack. First launch generates impact-pack.ini and pulls the default SAM checkpoint into models/sams; create an empty file named skip_download_model in custom_nodes to skip that download. You don't need any model for this node, obviously - but if you change custom_wildcards in the ini, restart ComfyUI, because that path is read at startup.

    Small honest verdict

    It's a text file and a dropdown, and it will not make your images better. What it does is make a bunch of prompt experiments reproducible from one graph, which is worth more than it sounds when you're comparing something across twenty prompts and want the filenames to match. If you're already using ImpactWildcardProcessor, this is the clean way to feed it preset lines instead of building one giant wildcard with hand-numbered selection weights.

    CategoryImpact Pack/Wildcard

    Inputs (4)

    NameTypeDefaultDescription
    categoryCOMBO2 options: styles, poses
    text_wildcardCOMBO1 options: (styles.txt not found)
    modeCOMBO4 options: fixed, random, sequential, batch
    seedINT00–18446744073709550000—

    Outputs (2)

    NameTypeDescription
    textSTRING—
    nameSTRING—