Nodes/tri3d-comfyui-nodes/Save text to an absolute path and provide text optional to control execution order v5.1.0
ComfyUI Node

Save text to an absolute path and provide text optional to control execution order v5.1.0

The node that writes your prompts and sidecars where you need them

By TRI3D-LC·Created 3 years ago·Updated about a year ago· 27
Save text to an absolute path and provide text optional to control execution order v5.1.0
    • same text as input
    text
    absolute_filenameimage.txt
    text_opt

    Text isn't only for prompts - sometimes you need a file. A sidecar .txt next to each generated image, a prompt log a script consumes, a manifest that says what the batch produced. SaveText_absolute writes whatever text you give it to an absolute path. That's the entire job, and it does it with a level of control ComfyUI's built-in text handling doesn't offer, because you pick the exact path.

    The full name trails a second promise: "and provide text optional to control execution order." There's an optional text_opt input whose tooltip spells out the purpose - it exists to create work files after text files, i.e. to force ordering. Wire the output of an earlier save into it and ComfyUI guarantees this node runs after that one, which matters in automation where a downstream process watches a folder and reacts to file arrival.

    How it works

    Rudimentary and reliable: it opens the file at absolute_filename in write mode and dumps the text string into it, overwriting whatever was there. The text_opt input doesn't affect the written content at all - it only exists to enforce execution order. The output is the same text you put in, which lets you chain the node into the graph as a data pass-through as well as a side effect.

    The inputs that matter

    • text (STRING, multiline) - what gets written. Dynamic prompts are enabled, so wildcard/{prompt} syntax gets resolved before saving.
    • absolute_filename (STRING, default image.txt) - full path, e.g. /home/me/pipeline/prompt.txt.
    • text_opt (STRING, multiline, optional) - ordering only. The tooltip says it plainly: "Text to provide order when necessary (to create work files after txt files)."

    Output: same text as input (STRING).

    Installing it

    Part of TRI3D-LC/tri3d-comfyui-nodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/TRI3D-LC/tri3d-comfyui-nodes
    cd tri3d-comfyui-nodes
    pip install -r requirements.txt
    

    or ComfyUI Manager → "tri3d-comfyui-nodes", restart. Lives in the text category.

    Common issues

    • Overwrites without asking - it's a plain open(path, "w"). If a file already exists there, it's gone. Build unique filenames upstream if you're saving per-run sidecars.
    • The optional input doesn't change output - people assume text_opt merges into the saved file. It doesn't. It's purely an ordering dependency, and the README-less source only hints at that via the tooltip.
    • Path discipline - absolute only; a relative path writes relative to ComfyUI's CWD and you'll hunt for it later.
    • No mkdir - if the target directory doesn't exist, the write fails. Create the folder before running.

    This node plus SaveImage_absolute is the classic automation pair: save the image, save the matching prompt text, and drive ordering with the string wires. For one-off "look at this," neither is needed - but for pipelines that touch the filesystem, they're the way out of ComfyUI's output folder.

    Categorytext

    Inputs (3)

    NameTypeDefaultDescription
    textSTRINGText to be saved to the file.
    absolute_filenameSTRINGimage.txtThe absolute path to the file to save.
    text_optoptSTRINGText to provide order when necessary (to create work files after txt files).

    Outputs (1)

    NameTypeDescription
    same text as inputSTRING