Nodes/ComfyUI-ZML-Image/ZML_文本行
ComfyUI Node

ZML_文本行

Pick a line from a file, in order, random, or by index — ZML_文本行

By zml-w·Created about a year ago·Updated 2 months ago· 218
ZML_文本行
    • 文本
    • help
    文件选择
    模式
    索引0
    随机行数1
    文本

    ZML_文本行 is a one-line picker with a memory. Give it a text file (or type lines yourself) and it returns a single line - chosen by index, in order, or at random - and it remembers where it is between runs. For anyone doing "random artist" or "load my 1000-prompt file one at a time" workflows, this is the node.

    The default dropdown is what makes it worth a look. It ships with four real tag files in the pack's zml_w/txt folder:

    • 1000图以上画师danbooru的tag.txt - a big danbooru tag list
    • 光辉画师串plus.txt, 画师-1348.txt, 画师(1000).txt - three artist-name lists (about a thousand artists each)

    The author is an anime-prompt person and it shows; these are the lists you'd use to randomize a character or artist while keeping the rest of the prompt fixed. You can also drop your own .txt into zml_w/txt and it appears in the dropdown, or set 文件选择 to 禁用 and type lines into the optional 文本 box instead.

    Three 模式 settings control the picking. 索引 reads the exact line at 索引 (0-based). 顺序 steps through the file one line per run - and this is the clever bit, each node keeps its own counter in a JSON file under zml_w/counter, so two of these nodes in one workflow don't share a position. The counter resets on ComfyUI restart. 随机 grabs a random line, and with 随机行数 you can pull several lines at once (the author added that later; it used to be single-line only).

    Outputs are the chosen 文本 and a help string explaining all this in Chinese. Output is a plain STRING, so wire it into a prompt encoder, a text list, or a filename builder.

    Installing it

    Part of ComfyUI-ZML-Image. ComfyUI Manager → install ComfyUI-ZML-Image, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/zml-w/ComfyUI-ZML-Image
    

    Restart after. No model downloads - the bundled tag files come with the pack. The English translation patch lives at https://github.com/zml-w/ZZZ_ZML_English_Patch; without it, expect the dropdowns and labels in Chinese.

    Common issues

    The 顺序 counter is per-node and stored in a JSON file that gets rewritten on startup, so if ComfyUI crashes mid-run your "position" resets. Not a big deal - it's a line counter, not a state machine. If you drop in your own file and it doesn't show, make sure it's a .txt directly in zml_w/txt (not in a subfolder, and not in "Preset text"). And a heads-up: random mode with 随机行数 > 1 returns multiple lines but still as one text output - join them or feed a list node if you need each line separately.

    One honest caveat: this is a node from a solo developer who says plainly he polishes what he uses. The random and index paths are solid. If 顺序 ever misbehaves for you, restart ComfyUI and check the counter file before filing an issue.

    Categoryimage/ZML_图像/文本

    Inputs (5)

    NameTypeDefaultDescription
    文件选择COMBO5 options: 禁用, 1000图以上画师danbooru的tag.txt, 光辉画师串plus.txt, 画师-1348.txt, 画师(1000).txt
    模式COMBO3 options: 索引, 顺序, 随机
    索引INT0
    随机行数INT1
    文本optSTRING

    Outputs (2)

    NameTypeDescription
    文本STRING
    helpSTRING