[Book Tools] Prompt Batch Schedule
Turn a list of page descriptions into a prompt lookup table
- DICTIONARY
BTPromptSchedule is the batch-scheduling half of the Book Tools prompt pair. You give it a list of prompt fragments - one per book page, say - plus optional text to prepend and append to every entry, and it returns a dictionary where each entry is numbered. Its sibling, BTPromptSelector, then pulls one of those entries out per page as the loop steps through. It's the "plan all the prompts up front, feed them one at a time" pattern, and for anything multi-page it beats hand-editing prompts mid-run.
How it works
Three inputs: text (multiline), before_text, and after_text. The code splits text on the two-character sequence ", - a quote followed by a comma - strips the quote characters, and builds one dictionary entry per segment, keyed "1", "2", "3"…
The important formatting detail is right there in the default value:
"first page description",
"second page description"
Quotes around each entry matter, because the split happens on ",. If you write plain comma-separated text without the surrounding quotes, the node won't split at all and you'll get one giant entry. Copy the default's format and you're fine.
before_text and after_text are prepended and appended to every entry, joined with ", ". So with before_text set to "cover art,", entry 1 becomes "cover art, first page description". That's your way to stamp a consistent style or subject prefix across the whole batch without retyping it per page.
The single output is a DICTIONARY - numbered strings you'll feed straight into BTPromptSelector. Note that DICTIONARY is a custom type, not core ComfyUI, so in practice it only plugs into BTPromptSelector's dictionary input. They're a matched pair.
The flow it's built for
Typical book workflow:
- BTPromptSchedule - list all page descriptions, add your shared prefix/suffix.
- BTPromptSelector - pick the current page's entry by index (set it to a single number - its default
"1,2,3"returns an empty string, a known trap). - CLIPTextEncode - feed the selected string to your sampler.
- BTLoop - drive the selector's index up one per pass so each page renders its own prompt.
That turns "render a twenty-page book" into one queue run.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/Big-Idea-Technology/ComfyUI-Book-Tools
# restart ComfyUI
Or in ComfyUI Manager, search "ComfyUI-Book-Tools". The pack is pure Python - no models, no extra pip dependencies beyond what ComfyUI ships, nothing to download.
A couple of real-world notes
Watch your commas. Because splitting happens on ",, an entry that contains a comma inside its own description is fine - the split key is quote-then-comma, so only the separators trip it. And the dictionary output isn't editable after the fact the way a text file would be; if a description changes, edit the node's text field and re-run. For previewing what actually got built, stick a Show Text on the selector's output before you burn GPU time on a twenty-page batch.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | "first page description", "second page description" | — |
| before_text | STRING | — | |
| after_text | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DICTIONARY | DICTIONARY | — |