How to change fader (or panner) automation mode on multiple tracks at once?

Would it be possible to have lua script which would switch fader (and/or panner) automation mode (state) of selected tracks to “touch” or “play” or whatever?
Maybe there is another simple way to achieve this?
Basically I would like to change fader and panner automation state on multiple tracks all at once.
Thank you for any help.

The only other way currently is to use the “all” modifier Ctrl+Shift+Click (Cmd+Shift on Mac) on the automation button in the mixer to change the fader automation of all tracks.

Thank you. It’s always something.
What about scripting? Can it be achieved that way?

It should also work in ardour 5.12, but so far only tested with Ardour/git.
Save to ~/.config/ardour5/scripts/set_automation_mode.lua (on GNU/Linux)

All hail the mighty Ardour Lua Task Force :upside_down_face: Thank you.