Nodes/Bjornulf_custom_nodes/โœ’๐Ÿ—”๐Ÿ…ฐ๏ธ Advanced Write Text
ComfyUI Node

โœ’๐Ÿ—”๐Ÿ…ฐ๏ธ Advanced Write Text

A1111-style wildcards, native in ComfyUI

By justUmenยทCreated 2 years agoยทUpdated about a year agoยท 545
โœ’๐Ÿ—”๐Ÿ…ฐ๏ธ Advanced Write Text
    • text
    โ—„textโ€”โ–บ
    โ—„variablesโ€”โ–บ
    โ—„seed0โ–บ

    If you came from Automatic1111, you probably remember wildcard syntax - {brown|blonde|black} hair randomly picking one option each generation, the kind of trick people used to batch out character variations without training anything. That syntax mostly got left behind when people moved to ComfyUI, and a lot of newer users have genuinely never seen it. Advanced Write Text brings it back, built directly into a single text node, no separate wildcards pack required.

    It's the beefed-up sibling of the plain Write Text node in justUmen's Bjornulf_custom_nodes pack - same idea, multiline box in, STRING out, but this one parses special syntax inside the text and logs what it picked to the ComfyUI console, which is genuinely useful when you're debugging why a batch came out weird.

    How it works

    Write {hood|helmet} anywhere in your text and the node randomly resolves it to one of the options every time it runs - pair that with seed and control_after_generate (set the latter to randomize on the node) and you get fresh picks every run, same as a KSampler seed widget. It also prints both the raw and resolved text to the console (Raw text: ... / Picked text: ...), so when a batch produces something unexpected you can go back and see exactly what got picked instead of guessing.

    Past the basic pick, there's real depth here. You can define and reuse a value with <name> syntax so the same random pick shows up consistently in multiple places in one prompt. Groups let you avoid duplicates across placeholders: {left|right|middle|group=LMR} repeated three times will assign each instance a different value from that set instead of possibly repeating one. Weighted picks work too - {A(80%)|B(15%)|C(5%)} biases the random choice by the percentages given. And a static_group variant lets a value stay fixed and consistent across placeholders without competing for uniqueness the way group does.

    This is functionally the same territory Impact Pack's wildcard system covers for people who want the more "official" ComfyUI-native route - if you're already leaning on Impact Pack for detailing, its wildcards are worth knowing about too. This node is the lighter-weight option if you just want the syntax in one box without pulling in a bigger pack for it.

    The inputs and outputs that matter

    • text (required, multiline) - your prompt, with as much or as little {a|b|c} syntax as you want.
    • variables (optional, multiline) - where you can predefine values for the <name> reuse syntax.
    • seed (optional, default 0) - drives the randomization; expose control_after_generate on the node and set it to randomize if you want a new pick every run.

    One output: text, the fully resolved STRING, ready for a CLIP Text Encode node, a TTS input, or wherever else.

    How to install it

    ComfyUI Manager: search "Bjornulf_custom_nodes," install, restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/justUmen/Bjornulf_custom_nodes
    

    restart ComfyUI. No special dependency for this node beyond core ComfyUI - the pack's heavier requirements.txt entries (ollama, ffmpeg-python, opencv-python, and others) only apply to its video/AI nodes elsewhere in the pack.

    Common issues & troubleshooting

    Same seed, different-looking-but-not-really images across a loop. This is a known quirk of the pack: inside a Bjornulf loop, seed randomization only advances once per full workflow run, not per iteration, so if you're chaining this into a loop expecting a fresh pick each pass, pair it with the pack's Text with random Seed node to force real per-iteration variety.

    The console logging is silent. Make sure you're actually looking at the terminal running ComfyUI, not just the browser console - this node logs to the Python process's stdout, not the browser dev tools.

    Breaking syntax changes between versions. The pack's changelog is full of โ— Breaking changes entries, and the group/percentage/static_group syntax specifically arrived across a couple of point releases - if an older saved workflow's syntax stops resolving the way you remember, check you're on a current version and that the syntax matches what's documented for that version.

    CategoryBjornulf

    Inputs (3)

    NameTypeDefaultDescription
    textSTRINGโ€”
    variablesoptSTRINGโ€”
    seedoptINT00โ€“18446744073709550000โ€”

    Outputs (1)

    NameTypeDescription
    textSTRINGโ€”