BatchIterator String Emitter
Count ticks, fire once when you hit the target, and (bonus) abort on -999
- count
- emit_result
BatchIterator String Emitter (class BatchIteratorStringEmitter) is the counter/gate for the BatchIterator family: every time touch pulses, it adds step to a per-key_id count, and when the count reaches your conditions it fires emit_result = true. That's the signal you feed into BatchIteratorStringCallback so the collected strings get read out exactly once the loop has run the right number of times.
Think of it as the "how many times have we done the thing" node. It's the BatchIterator rework of AsyncOutputEmitter - same count-then-fire shape, with a couple of meaningful differences: only two modes (== and >=), and it does not delete its counter record when it fires, so re-touching it on a later run keeps counting rather than starting fresh. That makes it more forgiving in a loop where the emitter might get nudged more than once after crossing the threshold.
How it works
State lives in ASYNC_OUTPUT_BATCH_ITERATOR_STORAGE_DATA_COUNTER_DICT, keyed by key_id. A touch of false just reports the current count; true advances by step. In == mode it fires only when the count lands exactly on conditions; in >= mode, the first time it reaches or passes. reset zeroes the count without firing. And the pack's version of a kill-switch: if conditions is -999, the node raises an exception on purpose - the schema tooltip calls it "a active interrupt signal." It's an intentional abort, the kind of thing you wire up when a runaway loop needs a hard stop you can see.
The inputs that matter
touch(BOOLEAN, forced) - the pulse that advances the counter.key_id(STRING) - shared with the Collection and Callback.conditions(INT, default 1) - the target count;-999is the interrupt signal.mode(==/>=, default==).step(INT, default 1) - increments per touch.reset(BOOLEAN, optional).
Outputs: count (INT) - current count ("Current Count Value" per the tooltip), and emit_result (BOOLEAN) - true when the condition is met.
Installing it
No dependencies, no model files. ComfyUI Manager → search "AsyncOutput" → install and restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/teddy1565/ComfyUI-AsyncOutput
It's under AsyncOutput/BatchIterator/String - the non-deprecated side of the pack.
Where people get burned
The -999 interrupt is the detail that'll surprise you if you feed arbitrary computed values into conditions - a stray -999 kills the run. It's deliberate, so don't fight it; just don't let -999 fall out of some upstream math you weren't expecting to drive this node. And remember it differs from the AsyncOutput emitter: no record deletion on fire and only two modes. If you need exact/greater_than_or_equal naming or one-shot re-arming behavior, that's the deprecated family's node instead.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| touch | BOOLEAN | — | |
| mode | COMBO | == | 2 options: ==, >= |
| key_id | STRING | — | |
| step | INT | 1 | — |
| conditions | INT | 1 | if input -999, will raise, it's a active interrupt signal |
| resetopt | BOOLEAN | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| count | INT | Current Count Value |
| emit_result | BOOLEAN | if count == conditions, return true. then remove this record |