Nodes/AUN ComfyUI Nodes/AUN Any Index Switch
ComfyUI Node

AUN Any Index Switch

Route any type, any 20 inputs, by one number

By loz2754·Created 8 months ago·Updated about 15 hours ago· 5
AUN Any Index Switch
  • value1
  • value2
  • value3
  • value4
  • value5
  • value6
  • value7
  • value8
  • value9
  • value10
  • value11
  • value12
  • value13
  • value14
  • value15
  • value16
  • value17
  • value18
  • value19
  • value20
  • output
  • label
index1
visible_inputs20
label_modeNode Title

Most index switches in ComfyUI are typed - one for strings, one for latents, one for models. AUNAnyIndexSwitch says no to all that and switches anything: up to 20 inputs of any type, selected by a single integer. Models, latents, images, conditioning, floats - whatever you plug in, the node routes the chosen one out and drops the rest. It's the "AUN Any Index Switch" in the menu, and it's the workhorse of the pack's "make one number drive everything" pattern.

The control surface is three widgets. index (1-20) is the selector, and it can be driven by another node's INT output - wire a AUNRandomIndexSwitch (the pack's Random/Select INT node) into it and your graph gets a single dial that picks one of 20 models, or one of 20 latents, or one of 20 anything. visible_inputs (2-20) trims how many sockets actually show on the node, so you don't stare at twenty empty ports when you're only using four. label_mode chooses what the second output reports: Node Title gives you the title of whichever node is feeding the selected input, Slot Label gives you the connected output slot's label instead.

The outputs are output (whatever was selected, in its original type) and label (a string naming it). That label output is the sneaky-good part: combine it with the pack's filename machinery or a Show Text node and your filenames and previews can name their own source. "Which model made this?" becomes a question your workflow answers for you.

There's frontend machinery under the hood - a bit of JavaScript watches visible_inputs and dynamically adds or removes the value1value20 sockets so the node's shape matches its config, and the inputs are declared as universal * types so any connection validates. Values above the visible count clamp rather than error, which is a friendly touch.

Where this shines is the "one seed selects a whole configuration" pattern: an index drives this switch, a AUNTextIndexSwitch for the prompt, and AUNEmptyLatent's aspect ratio for dimensions - one random number and you've got a completely different generation recipe every run. Same idea powers the README's example workflow for randomly selecting prompts.

Install with the pack: ComfyUI Manager (search "AUN") or cd ComfyUI/custom_nodes && git clone https://github.com/loz2754/AUN-ComfyUI-Nodes, then restart. Like the other utility nodes it's dependency-light - piexif, opencv-python-headless, imageio-ffmpeg, requests - and needs no model downloads. If your graph keeps growing typed switch nodes, this is the one to replace them with.

CategoryAUN Nodes/Utility

Inputs (23)

NameTypeDefaultDescription
indexINT11–20Index number (1-20) to select which input to output. Values above the visible count are clamped.
visible_inputsINT202–20How many input sockets to display on the node (2-20).
label_modeCOMBONode TitleChoose label source: 'Node Title' shows the connected node's title, 'Slot Label' shows the connected output slot's label.
value1opt*Input 1 (any type). Only the selected index is output.
value2opt*Input 2 (any type). Only the selected index is output.
value3opt*Input 3 (any type). Only the selected index is output.
value4opt*Input 4 (any type). Only the selected index is output.
value5opt*Input 5 (any type). Only the selected index is output.
value6opt*Input 6 (any type). Only the selected index is output.
value7opt*Input 7 (any type). Only the selected index is output.
value8opt*Input 8 (any type). Only the selected index is output.
value9opt*Input 9 (any type). Only the selected index is output.
value10opt*Input 10 (any type). Only the selected index is output.
value11opt*Input 11 (any type). Only the selected index is output.
value12opt*Input 12 (any type). Only the selected index is output.
value13opt*Input 13 (any type). Only the selected index is output.
value14opt*Input 14 (any type). Only the selected index is output.
value15opt*Input 15 (any type). Only the selected index is output.
value16opt*Input 16 (any type). Only the selected index is output.
value17opt*Input 17 (any type). Only the selected index is output.
value18opt*Input 18 (any type). Only the selected index is output.
value19opt*Input 19 (any type). Only the selected index is output.
value20opt*Input 20 (any type). Only the selected index is output.

Outputs (2)

NameTypeDescription
output*
labelSTRING