Still, nothing can really be "auto" unless it is a built-in feature. Mods have to attach a non-vanilla feature to some events (as mentioned above) to make it looks like "automatic". It is a matter of finding a "suitable event" for a smart conditional trigger.
Of course I know the shift-click insertion. But isn't shift-click the full battery still a "manual" action?
But anyway, just an idea pops up in my mind, but still not as "auto" as you wanted.
I have something similar to my defense equipment reload/unload script in my mod Schall Gun Pod. That mod is doing checks on energy level of those defense equipment, then calculates how much ammo is consumed/returned. Those actions are triggered by hotkeys or shortcuts.
I can borrow the script. But this time it performs actions only on primary battery equipment. When hotkey/shortcut triggers, the script removes that if the power level is very low or near zero, and checks if full battery of same type is in inventory, and consumes that. I would call it a "Replace empty battery" hotkey/shortcut.
This requires a "manual" trigger (hotkey/shortcut), so still not "fully auto". But I guess this will be even more convenient than auto-remove empty batteries + shift-click insert full batteries.