ComfyUI > Nodes > ComfyUI_Mira > Text Switcher

ComfyUI Node: Text Switcher

Class Name

TextWithBooleanSwitchAndCommonTextInput

Category
Mira/Text
Author
mirabarukaso (Account age: 1261days)
Extension
ComfyUI_Mira
Latest Updated
2024-07-25
Github Stars
0.03K

How to Install ComfyUI_Mira

Install this extension via the ComfyUI Manager by searching for ComfyUI_Mira
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI_Mira in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Text Switcher Description

Dynamic text input combining based on boolean switches for efficient text data manipulation and formatting control.

Text Switcher:

The TextWithBooleanSwitchAndCommonTextInput node is designed to dynamically combine text inputs based on boolean switches, making it a versatile tool for AI artists who need to manage and manipulate text data efficiently. This node allows you to choose between two text inputs and prepend or append a common text string to the selected text. This functionality is particularly useful for generating text outputs that require consistent formatting or tagging, such as quality tags or other repetitive text elements. By leveraging the boolean switches, you can easily control the text combination process, ensuring that the output meets your specific requirements without manual intervention.

Text Switcher Input Parameters:

use_text2

This boolean parameter determines which text input to use for the output. When set to True, the node will use text2 as the primary text input; otherwise, it will use text1. This switch allows you to easily toggle between two different text inputs based on your needs. The default value is False.

common_text_at_front

This boolean parameter controls the placement of the common text. When set to True, the common text will be placed at the front of the selected text input. If set to False, the common text will be appended to the end of the selected text input. This parameter helps you manage the positioning of the common text in the final output. The default value is False.

text1

This is the default text input that will be used when use_text2 is set to False. It is a multiline string parameter, allowing you to input longer text blocks if needed. This text serves as the primary content for the output when the boolean switch is not enabled.

text2

This is the alternative text input that will be used when use_text2 is set to True. Like text1, it is a multiline string parameter, providing flexibility for longer text inputs. This text serves as the primary content for the output when the boolean switch is enabled.

common_text

This is the common text that will be either prepended or appended to the selected text input based on the common_text_at_front parameter. It is a multiline string parameter, allowing you to input text that will be consistently added to the final output. This is useful for adding tags, prefixes, or suffixes to your text.

Text Switcher Output Parameters:

text

This output parameter provides the combined text based on the selected text input (text1 or text2) and the common text. The position of the common text is determined by the common_text_at_front parameter. This output is useful for generating the final formatted text that includes the necessary tags or additional information.

alt_text

This output parameter provides an alternative combined text, which is essentially the reverse combination of the text output. If text is common_text + text1, then alt_text will be common_text + text2, and vice versa. This allows you to have two different formatted text outputs based on the same inputs and boolean switches.

Text Switcher Usage Tips:

  • Use the use_text2 switch to easily toggle between two different text inputs without manually changing the text.
  • Utilize the common_text_at_front parameter to control whether the common text appears at the beginning or end of your main text, depending on your formatting needs.
  • Input longer blocks of text in text1 and text2 to take full advantage of the multiline capabilities, especially for complex text generation tasks.

Text Switcher Common Errors and Solutions:

Missing text input

  • Explanation: One or both of the text inputs (text1 or text2) are not provided.
  • Solution: Ensure that both text1 and text2 are filled with the necessary text content before executing the node.

Invalid boolean value

  • Explanation: The boolean parameters (use_text2 or common_text_at_front) are not set correctly.
  • Solution: Verify that the boolean parameters are set to either True or False as required for your specific use case.

Common text not applied

  • Explanation: The common_text parameter is left blank, resulting in no common text being added to the output.
  • Solution: Ensure that the common_text parameter is filled with the desired text to be added to the main text inputs.

Text Switcher Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI_Mira
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.