Nodes/AUN ComfyUI Nodes/Extract Widget Value
ComfyUI Node

Extract Widget Value

Reach into any node and read one of its widgets

By loz2754·Created 8 months ago·Updated about 24 hours ago· 5
Extract Widget Value
    • string
    • float
    • int
    node_identifier0
    widget_namemodel
    fallback
    basename_if_pathtrue
    concat_widget_namefalse

    AUNExtractWidgetValue is the general-purpose version of the pack's Extract Model Name: instead of knowing about model loaders, it can read any widget or input off any node in your workflow. Seed, steps, strength, a dropdown value, a filename field - if a node has it, this node can pull it out as a typed value. The use case is the same one that powers half of AUN's ecosystem: getting the numbers that actually ran into your filenames, labels, and sidecars instead of retyping them by hand.

    Two required inputs point it at the target. node_identifier takes the node's numeric ID or its title (matching is case-insensitive for the widget name and tolerant of subgraph namespacing, so it works inside subgraphs too). widget_name is the input or widget to read - model, seed, steps, whatever the target node exposes. The default is model, which tells you the intended use: pulling a model name off a loader. But it's not restricted to that.

    The optional inputs give you control over the dirty edges. fallback is what gets returned if the widget isn't found - handy when a node might not have the widget you asked for. basename_if_path (default on) converts a value that looks like a path into just its basename, which is exactly what you want when reading model off a loader and getting models/checkpoints/foo.safetensors. concat_widget_name (default off) prepends the widget name with a dash when on, so you get seed-12345 instead of 12345 - useful for building label text in one step.

    Then the outputs, and this is the part beginners miss: it returns the same value as a STRING, a FLOAT, and an INT all at once. The float output is the value parsed as a float (for steps, seed, numeric strengths), the int output as an integer, and the string as-is. You just pick the type your downstream node wants - wire the INT output into a node that wants an int, the FLOAT into a CFG socket, the STRING into a filename builder. No separate "to int" conversion nodes in between.

    Mechanically it's graph scraping plus type conversion: it resolves the node in the workflow JSON (by ID, then by title), reads the requested widget's value, applies the path-to-basename sanitization, and coerces to all three types. IS_CHANGED forces a re-read each run so it always reflects the current widget state - swap the seed and the extracted int follows.

    Install with the pack: ComfyUI Manager (search "AUN") or cd ComfyUI/custom_nodes && git clone https://github.com/loz2754/AUN-ComfyUI-Nodes, then restart. Dependency-light, no models. If you're reaching for it constantly, the pack's AUNGraphScraper is the multi-widget, template-based version of the same idea - one node that scrapes a whole line of values at once.

    CategoryAUN Nodes/Utility

    Inputs (5)

    NameTypeDefaultDescription
    node_identifierSTRING0Numeric ID or Title of the node to inspect.
    widget_nameSTRINGmodelInput/widget name to read from the node (case-insensitive).
    fallbackoptSTRINGValue to return if the widget isn't found.
    basename_if_pathoptBOOLEANtrueIf the value looks like a path, return only the basename.
    concat_widget_nameoptBOOLEANfalseIf true, concatenate the widget name and value with a dash.

    Outputs (3)

    NameTypeDescription
    stringSTRING
    floatFLOAT
    intINT