A drop‑in replacement for the PrimitiveInt node that automatically resets its value to 0 after a batch finishes.
- Works exactly like
INT(PrimitiveInt) – has the built‑incontrol_after_generatedropdown (increment / decrement / randomize). - Auto‑reset after batch completion – value returns to 0 the moment the entire queue finishes (Auto mode) or after a configurable countdown (Manual mode).
- Reset on interruption – when you click Stop or cancel a batch, the counter instantly resets to 0, even mid‑generation.
- Visual status badge – a coloured badge on the node confirms each reset.
- Hands‑free operation – set it once, pair with
auto_prompt_schedule(or any counter‑driven node), and forget about it.
- Open your ComfyUI
custom_nodesfolder (e.g.ComfyUI/custom_nodes/). - Clone this repository:
git clone https://github.com/majidfida/comfyui_auto_reset_int.git
- Restart ComfyUI.
The node will appear in the utils category as Auto Reset Int 🔄.
- ComfyUI 0.20.1 or newer (tested with
0.20.1, frontendv1.43.17). - No additional Python packages – the node is pure Python + JavaScript.
- Add the Auto Reset Int 🔄 node to your workflow.
- Connect its INT output to the counter input of another node (e.g.
auto_prompt_schedule’s frame index). - Leave the
control_after_generatedropdown on Increment (it’s the default). - Queue your batch of images as usual – press Run and enter the number of images you need.
- After the last image finishes, the counter automatically resets to 0 – you don’t touch anything.
- Set
reset_modeto Manual. - Adjust
reset_delay_secondsto the desired countdown (3 seconds by default). - After the queue empties, the node will display a countdown badge and then reset.
- If you click Stop while a batch is running, the counter instantly resets to 0, and a yellow badge confirms it.### Defaults
| Widget | Default | Purpose |
|---|---|---|
value |
0 | The counter value. Incremented/decremented by the dropdown. |
control_after_generate |
Increment | Tell ComfyUI to automatically add 1 after each generation. |
reset_mode |
Auto | Auto = instant reset when queue empties; Manual = wait reset_delay_seconds. |
reset_delay_seconds |
3 | Only used in Manual mode. How many seconds to wait before reset. |
- Python (
node.py) simply passes the current integer through – all mutation is handled by ComfyUI’s nativecontrol_after_generatemachinery. - JavaScript (
js/auto_reset_int.js) listens toexecution_successandexecution_interruptedevents. It checks the queue state and resets the widget’s value to 0 directly in the frontend. A small badge is drawn on the node to confirm the action.
comfyui_auto_reset_int/
├── __init__.py # ComfyUI registration
├── node.py # Node logic
├── js/
│ └── auto_reset_int.js
└── README.md
Pull requests are welcome. If you encounter a bug or have a feature request, please open an issue.
MIT – do whatever you want with it, just keep the license file.