Widget to String
Read Any Node's Slider and Turn It Into Text
- any_input
- STRING
ComfyUI has a real gap: node values are data, but they aren't text. If you want to bake your CFG or your seed into a filename, or echo a slider value into a text prompt, there's no built-in way to just grab another node's widget and stringify it. Widget to String closes that gap. Point it at any node in your workflow, name the widget you want, and it reads the current value and hands it back as a STRING you can splice into filenames, prompts, or save metadata.
How it works
This is a workflow-metadata trick, and it's worth understanding so you're not confused by what it can and can't do. ComfyUI keeps a copy of the whole workflow's widget values in the prompt data, and this node (adapted from kjnodes' WidgetToString, per the source) reads that snapshot. You tell it where to look, it finds the value, and it formats it.
Three ways to target a node:
- id - the numeric node id (ComfyUI numbers nodes sequentially as you add them;
Ctrl+Ion a node shows its properties). Set this to a non-zero id and it reads that node. - node_title (optional, string) - if you've given a node a custom title, match on that instead. Title matching is more robust than id when a workflow gets rearranged.
- any_input (optional, any) - wire anything into this and the node walks the link backwards to find which node produced it, then reads that node. This is the most robust option for shared workflows because it survives renumbering.
Then:
- widget_name - the name of the widget you want. For a KSampler that's something like
stepsorcfg; for a sampler settings node it'sStepsorFlux_Guidance. This must match the internal widget name exactly, capitalization included. - return_all (default off) - flip it on and the node dumps every widget on the target node as
name: valuepairs joined by commas. Great for metadata strings. - allowed_float_decimals (default 2) - floats get truncated to this many decimal places when stringified. Handy when you don't want
3.5000000000000004in your filename.
Output is a single STRING. Wire it into a Save Image filename, a text display node, or a prompt builder.
Why it's worth having
The killer use is naming files by what generated them: steps_20_seed_12345 tells you more than image_00042. Since return_all gives you the whole settings block as one string, you can also push it into a prompt-save node to log exact generation settings alongside the image - which plays nicely with the pack's metadata-focused save nodes.
Installing it
Part of ComfyUI-RvTools_v2 - Manager → search "ComfyUI-RvTools_v2", or:
cd ComfyUI/custom_nodes
git clone https://github.com/r-vage/ComfyUI-RvTools_v2
# restart ComfyUI
No extra dependencies.
Gotchas
Because it reads the workflow snapshot, the value it returns is what was last executed, and the node needs valid workflow metadata to read from - save your workflow before relying on it. If you get "Widget not found" or "No matching node found", the widget name is probably misspelled or you're pointing at the wrong node; return_all is a good debug move because it shows every widget name the target actually has. And the pack-level note: RvTools_v2 is unmaintained in favor of ComfyUI_Eclipse.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| id | INT | 00–100000 | — |
| widget_name | STRING | — | |
| return_all | BOOLEAN | false | — |
| any_inputopt | * | — | |
| node_titleopt | STRING | — | |
| allowed_float_decimalsopt | INT | 20–10 | Number of decimal places to display for float values |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |