Build Filename String (WLSH)
Build Filename String (WLSH)
- counter
- filename
WLSH's save nodes (Image Save with Prompt and friends) have filename templating built right in - %time, %model, %seed, %counter placeholders that get resolved automatically when the image is written. That's convenient until you need the same filename convention somewhere the WLSH save nodes don't reach - a different pack's save node, a preview label, a text file written by something else entirely. This node pulls that templating logic out on its own: same placeholder syntax, same inputs, but instead of writing a file it just hands you back the finished filename as a plain string, for you to route wherever you actually need it.
The README's own framing is exactly this: it "takes inputs similar to the Image Save node, used to build a filename which can be passed to multiple other nodes." The keyword there is multiple - this is useful specifically when one resolved filename needs to feed more than one destination (say, a save node and a matching log entry, or a preview title and a text file), and you don't want to duplicate the same seed/model/counter wiring twice to get two independently-generated but supposedly-identical strings.
Inputs: filename is the one required field - a STRING, this is your template containing whichever placeholders you want resolved. The rest are all optional: modelname (a plain string, default empty) fills in %model, seed (default 0) fills in %seed, counter fills in %counter (note this field is typed SEED rather than plain INT in the schema - wire in an integer-producing source the same way you would for the other numeric fields), and time_format (default %Y-%m-%d-%H%M%S) sets the pattern used to render %time if your filename template includes it.
Output: a single filename STRING - the template with every placeholder you populated swapped out for its actual value. That string is generic; it's not tied to any WLSH-specific node type, so it'll plug into any node's STRING input, WLSH or otherwise.
Installing it: through ComfyUI Manager, search "wlsh_nodes"; or clone the pack directly:
cd ComfyUI/custom_nodes
git clone https://github.com/wallish77/wlsh_nodes
Restart ComfyUI. No models or extra dependencies - this is string manipulation only.
Where this saves real effort: if you're mixing WLSH's save nodes with a different pack's save node (or ComfyUI's own basic Save Image) in the same workflow and want both to agree on a naming convention, this node is how you keep that consistent without hardcoding the same resolved string twice. Build it once here, then feed the result into both destinations.
Troubleshooting: if a placeholder in your filename template isn't resolving, check that you actually wired the matching optional input - an unconnected modelname input, for instance, means %model in your template has nothing to substitute and will likely be left as-is or come out blank depending on how the underlying template engine handles a missing value. And remember counter's odd SEED typing in the schema; if a plain integer node refuses to connect, that mismatch is why - route through whatever numeric-producing node your graph already uses for seeds and it should behave the same as any other integer source.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| filename | STRING | — | |
| modelnameopt | STRING | — | |
| seedopt | INT | 00–18446744073709550000 | — |
| counteropt | SEED | 0 | — |
| time_formatopt | STRING | %Y-%m-%d-%H%M%S | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| filename | STRING | — |