KJNodes/textgenerated

Widget To String(WidgetToString)

This node locates the target node through two primary methods: one is by using the node's unique ID, and the other is through a user-defined node title.

Widget To String

STRING
id
0
widget_name
STRING
return_all
any_input
COMBO
node_title
STRING
allowed_float_decimals
2
KJNodes

The Widget To String node locates target nodes through three primary methods: by using the node's unique ID, via a user-defined node title, or by connecting an input to the any_input socket (used when neither ID nor title is provided).

The Widget To String node is a tool for extracting widget values from other nodes within a workflow. It captures the current value of a specific widget on a designated node and converts it into a STRING format for output, facilitating its use in other nodes that require text input.

Node Functionality

This node locates target nodes through three primary methods: by using the node's unique ID, via a user-defined node title, or by using the any_input connection as a fallback when neither ID nor title is given. It supports extracting values from a single widget or multiple widgets (specified by a comma-separated list) on the target node, and can handle various data types such as INT, FLOAT, and BOOLEAN. Its internal mechanism parses the workflow metadata to find the corresponding node based on the provided location information, then reads the value of the specified widget(s), and finally formats it into a string according to the settings (e.g., number of decimal places for FLOAT values).

Node Parameter Description - Widget To String

Connection Inputs (Inputs)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
any_inputIONo--An optional connection that identifies the target node when neither id nor node_title is set. It also ensures the target node exists in the workflow. Typically connected to the node from which you wish to read values.

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
idINTYes00 - 100000 (Step: 1)Specifies the unique numeric ID of the target node for precise node lookup. Leave at 0 to use the any_input connection or node_title if set. The valid range is 0 to 100000, with a step of 1.
widget_nameSTRINGYes--Specifies the name(s) of the widget(s) to read from the target node. Can be a single widget name or a comma-separated list of multiple widget names.
return_allBOOLEANYesFalse-Controls the output behavior when widget_name specifies multiple widgets. When False, outputs the first valid value. When True, concatenates all values into a single string for output.
node_titleSTRINGNo--Locates the target node using a user-defined node title. This is only effective if the node title has been manually modified.
allowed_float_decimalsINTNo20 - 10Number of decimal places to display for FLOAT values.

Output

Parameter NameData TypeDescription
STRINGSTRINGThe string output after converting the read widget value(s).

Usage Scenarios

In an image generation workflow, you can use this node to read the value of the "seed" widget from a KSampler node and pass it as part of a filename to a Save Image node. Alternatively, you can use it to capture the weight settings from a group of LoRA nodes and concatenate them into a descriptive prompt text.

Notes

Please note that when using the node ID for location, you need to enable "Node ID Badge Mode" in the main ComfyUI settings to display the IDs. The node title method only works if the user has manually edited the node title; otherwise, the node cannot be found using this method.
If you leave both id at 0 and node_title empty, you must connect an input to any_input to specify the target node.

The Widget To String node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…