ComfyUI load prompts from text file workflow

How to use the Text Load Line From File node from WAS Node Suite to dynamically load prompts line by line from external text files into your existing ComfyUI workflow.

Requirements

  • ComfyUI Manager: Recommended to manage plugins.
  • ComfyUI Custom Scripts : Provides the Show Text 🐍 node.
  • WAS Node Suite : Provides the Logic Boolean, Number Counter, Text Load Line From File nodes used in this workflow.
  • Text file with pre-made prompts, one per line.

Workflow explained

Whenever this workflow is run, a new prompt will be read from the specified text file using a combination of the Text Load Line From File and Number Counter nodes.

Load Prompt From File

ComfyUI sample worfklow with Text Load Line From File node from WAS node suite.

Load Prompt from File group explained

Load Prompt From File Group

Load Prompt from File group. The optional green nodes are for preview only and can be skipped.

  1. Your prompts text file should be placed in your ComfyUI/input folder
  2. Logic Boolean node: Used to restart reading lines from text file.
    1. Set boolean_number to 1 to restart from the first line of the prompt text file.
    2. Set boolean_number to 0 to continue from the next line.
  3. Number Counter node: Used to increment the index from the Text Load Line From File node, so it reads the next line each time the prompt is queued.
    1. Set start to the first line you want to read from the prompt file.
    2. Set stop to the last line you want to read from the prompt file.
    3. Set step to 1.00 to increase the counter by 1 each time the propmt is run.
  4. Text Load Line From File: used to read a line from the prompts text file.
    1. Convert the node’s index value to input.
    2. Set the file_path to the full prompt file path and name.
    3. Set mode to index.
  5. Primary Show Text 🐍 node: Used to preview the last loaded prompt. Every time the prompt is queued, this will show the next loaded line from your prompts text file.
  6. Secondary Show Text 🐍 node: Used to display the next line number that will be loaded from the prompt text file on the next prompt queue.
  7. Clip Text Encode: This node had its text converted to input in order to connect it to the line_text output of the Text Load Line From File node.

Once you have connected the Text Load Line From File node line_text output into the Clip Text Encode node’s text input, the rest of the workflow will continue as usual.

The sample Save Image node uses the filename_prefix %date:yyyy-MM-dd%/%date:hhmmss%_%KSampler.seed% to save the images on a folder with current date.

You can download pre-made prompt files from CivitAI or Hugging Face.

gliding, Robot factory, Mech suit, Space colony habitat, A world covered in dense, otherworldly forests, where the trees emit a bioluminescent glow during the long nights.
verdant, Time travel facility, Teleportation pod, Post-apocalyptic wasteland, A world with unpredictable gravity fluctuations, leading to floating islands and erratic weather patterns.
volumetric, Time travel facility, Mech suit, Artificial intelligence marketplace, A lush, jungle-covered world teeming with vibrant flora and diverse fauna, under a magenta sky.
gleaming, Alien research facility, Cybernetic-enhanced spacecraft, Alien battlefield, A world with unpredictable gravity fluctuations, leading to floating islands and erratic weather patterns.
gravity-defying, Futuristic skyscraper, Teleportation pod, Artificial intelligence marketplace, A tidally locked planet, with one side always facing its sun and the other perpetually shrouded in darkness.
extraterrestrial, Planetary terraforming station, Ion-powered speeder, Extraterrestrial amusement park, A lush, jungle-covered world teeming with vibrant flora and diverse fauna, under a magenta sky.
visionary, Multi-dimensional portal hub, Teleportation pod, Extraterrestrial amusement park, A lush, jungle-covered world teeming with vibrant flora and diverse fauna, under a magenta sky.
seamless, Zero-gravity laboratory, Gravity-defying hovercraft, Interstellar trading post, A tidally locked planet, with one side always facing its sun and the other perpetually shrouded in darkness.
gravity-defying, Alien research facility, Mech suit, Artificial intelligence marketplace, A barren desert planet with extreme temperature fluctuations and towering sand dunes stretching across its surface.
towering, Zero-gravity laboratory, Android-driven transport, Space colony habitat, A planet with multiple, concentric rings, casting intricate shadows and patterns on its surface.
soaring, Alien research facility, Ion-powered speeder, Virtual reality arcade, A gas giant with swirling, multicolored clouds, dotted with floating sky cities built by an advanced civilization.
thriving, Intergalactic space station, Teleportation pod, Interstellar trading post, A post-apocalyptic world, scarred by the remnants of a long-dead civilization and haunted by their technological marvels.
thriving, Futuristic skyscraper, Sublight exploration vessel, Post-apocalyptic wasteland, A world with unpredictable gravity fluctuations, leading to floating islands and erratic weather patterns.
gravity-defying, Robot factory, Warp-capable starship, Virtual reality arcade, A post-apocalyptic world, scarred by the remnants of a long-dead civilization and haunted by their technological marvels.
expansive, Time travel facility, Android-driven transport, Alien battlefield, A world covered in dense, otherworldly forests, where the trees emit a bioluminescent glow during the long nights.
verdant, Multi-dimensional portal hub, Hyperdrive-equipped space shuttle, Space colony habitat, A volcanic planet with constant eruptions and rivers of lava, providing abundant geothermal energy for its inhabitants.
verdant, Intergalactic space station, Warp-capable starship, Cyberpunk alleyway, A post-apocalyptic world, scarred by the remnants of a long-dead civilization and haunted by their technological marvels.
verdant, Time travel facility, Hyperdrive-equipped space shuttle, Extraterrestrial amusement park, A world rich in exotic minerals and rare elements, attracting prospectors and miners from across the galaxy.
cyberpunk, Planetary terraforming station, Android-driven transport, Artificial intelligence marketplace, A lush, jungle-covered world teeming with vibrant flora and diverse fauna, under a magenta sky.
soaring, Futuristic skyscraper, Teleportation pod, Interstellar trading post, A volcanic planet with constant eruptions and rivers of lava, providing abundant geothermal energy for its inhabitants.
colossal, Orbital defense platform, Ion-powered speeder, Extraterrestrial amusement park, A world covered in dense, otherworldly forests, where the trees emit a bioluminescent glow during the long nights.
mechanized, Robot factory, Gravity-defying hovercraft, Galactic council chamber, A planet with multiple, concentric rings, casting intricate shadows and patterns on its surface.
cyberpunk, Zero-gravity laboratory, Anti-gravity motorcycle, Galactic council chamber, A world rich in exotic minerals and rare elements, attracting prospectors and miners from across the galaxy.
biomechanical, Robot factory, Teleportation pod, Space colony habitat, A lush, jungle-covered world teeming with vibrant flora and diverse fauna, under a magenta sky.
apocalyptic, Underwater research base, Sublight exploration vessel, Interstellar trading post, A lush, jungle-covered world teeming with vibrant flora and diverse fauna, under a magenta sky.
cybernetic, Robot factory, Sublight exploration vessel, Extraterrestrial amusement park, A tidally locked planet, with one side always facing its sun and the other perpetually shrouded in darkness.
extraterrestrial, Time travel facility, Hyperdrive-equipped space shuttle, Post-apocalyptic wasteland, A world covered in dense, otherworldly forests, where the trees emit a bioluminescent glow during the long nights.
verdant, Futuristic skyscraper, Ion-powered speeder, Alien battlefield, A world rich in exotic minerals and rare elements, attracting prospectors and miners from across the galaxy.
visionary, Underwater research base, Ion-powered speeder, Space pirate hideout, A small, rocky moon orbiting a gas giant, with a network of subterranean tunnels carved by ancient inhabitants.
progressive, Orbital defense platform, Cybernetic-enhanced spacecraft, Space pirate hideout, A tidally locked planet, with one side always facing its sun and the other perpetually shrouded in darkness.

Feedback

If you need help with this workflow, kindly leave a comment using the Disqus Comments section below.

Disclaimer

The content in this post is for general information purposes only. The information is provided by the author and/or external sources and while we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the post for any purpose. Some of the content and images used in this post may be copyrighted by their respective owners. The use of such materials is intended to be for educational and informational purposes only, and is not intended to infringe on the copyrights of any individuals or entities. If you believe that any content or images used here violate your copyright, please contact us and we will take appropriate measures to remove or attribute the material in question.