Mute Input devices - AppleScript

Hi MPUers, I’m writing a script that toggles the volume of my mac’s input devices. I keep it to 0 when not using the mic. With the below script, it only changes the input volume of the last input device. Any way I can set the input volume of all input devices.

set volume input volume 100

AirPods Pro is set to 100 but the MacBook pro mic is 0. Sometimes people can’t hear from me from my AirPods so I have to open “Sound” and set the mac’s mic volume. Is there a way I can set the volume of all the devices together, so when I remove my AirPods, the mac’s mic volume is already in set correctly.

Last time I looked at this problem I was unable to find an answer on how to address a specific device with any automation.

It seems like you need real code to call macOS APIs or find some app that offers user control and a scripting interface.