ComfyUI Node

🐟String List

Pick your prompts by number, in order, or at random

By liuqianhonga·Created 2 years ago·Updated about a year ago· 13
🐟String List
  • string_list
  • string_list
  • strings
p1_select_by_numbers
p2_select_sequentialfalse
p3_select_random_count-1
translate_outputfalse
string1
string2
string3
string4
string5
string6
string7
string8
string9
string10

If you've ever wanted one workflow that silently pumps out a different prompt each run - a prompt roulette for batch generation - this is the node for it. 🐟String List is the flagship of the ComfyUI-String-Helper pack: it holds up to ten multiline strings and hands you one or more of them, selected the way you tell it to. No translation magic, no models, nothing clever hiding under the hood - just string selection done properly.

What it does

The node is basically ten text boxes plus three competing selection modes. You type strings into string1 through string10 (or wire text in from upstream nodes - the slots are plain STRING inputs), optionally bolt on an external string_list, and then pick a mode. There's a strict priority order baked into the design, and it's the one thing that trips everyone up:

  1. p1_select_by_numbers - the boss. Put 1,3,5 in here and you get exactly those entries (1-based), in that order.
  2. p2_select_sequential - flip this to true and each execution returns the next string, wrapping around to the start when it hits the end. Classic "one prompt per queue run" behavior.
  3. p3_select_random_count - the default mode, and the weirdest of the three. -1 means "everything," 0 means "nothing," and any number from 1–10 means "that many random picks." Note it draws without replacement - random.sample - so you won't get duplicates in a single pick.

There's also a translate_output toggle: flip it on and whatever got selected is sent through a free Bing translator and returned in English. More on that translator below, because it's the pack's one real dependency and its one real caveat.

The outputs

Two outputs, same data: string_list is the LIST you wire into batch/batching nodes, and strings is the same content as a list of STRINGs (ComfyUI treats it as one string per slot for downstream text nodes). Most people wire strings into a prompt text encode and let the node's IS_CHANGED = true flag do the work - that flag is the secret sauce, it forces the node to actually re-execute on every queue run so sequential and random modes genuinely rotate instead of caching the first result forever.

Installing it

From ComfyUI Manager, search "ComfyUI-String-Helper" and install. Or, by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/liuqianhonga/ComfyUI-String-Helper.git

Restart ComfyUI. The pack's only real dependencies are translators and chardet - tiny pip packages, no models, no download drama. If you're on an offline box, skip the translation toggle and the node still works fine.

Gotchas

The translator is the part to be wary of. It's the free Bing endpoint wrapped by the translators library, so it needs internet and it's rate-limited and occasionally flaky - failures come back as [翻译失败] ... strings baked straight into your output, which is quietly horrible if you didn't notice. Keep translation off unless you actually want it.

Also: the README for this pack is written in Chinese and describes an older translate_string CSV column - the code reads string / zh / tags instead. For this node it doesn't matter (no CSV involved), but keep it in mind if you graduate to the pack's CSV siblings.

For a beginner's ComfyUI overview, the ecosystem doc in our KB is worth a skim - this node solves the "batch variation" problem that's a big reason people abandon A1111 for the node graph in the first place.

CategoryString Helper

Inputs (15)

NameTypeDefaultDescription
p1_select_by_numbersSTRING
p2_select_sequentialBOOLEANfalse
p3_select_random_countINT-1-1–10
translate_outputBOOLEANfalse
string1STRING
string2STRING
string3STRING
string4STRING
string5STRING
string6STRING
string7STRING
string8STRING
string9STRING
string10STRING
string_listoptLIST

Outputs (2)

NameTypeDescription
string_listLIST
stringsSTRING