Nice, I had no idea you could script tmux like that! Reminds me of "expect", which I've used to automate interactive SSH sessions with network devices.
I started using tmux in 2009. There was no -p option when capturep command was first added. Old scripts that keep working tend not to get updated. I have updated it now. Thank you.
An area I don't know about is -C (control mode). libtmux could technically use it to get live updates rather than inefficiently and possibly needlessly querying session/window/pane info to keep objects up to date. Apparently iterm2's tmux integration uses it.
I use Tmux for starting 4 Bhyve VM's on FreeBSD via rc.local.
It really like it better than screen or daemon processes.
Nice for large compiling jobs on remote machines too.
Just this night I was thinking if whether tmux scripting could be abused to get it to work like zmodem. Sending files from the system with the tmux session to whatever machine one had sshd into (and ideally the other direction as well).
Tmux has pipe-pane, and it has -I and -O to go both directions.
It does require some gyrations to get around the fact that it logs everything (the command itself, terminal control, etc), and not just what's output by the command. Here's a quick and dirty example:
a) Start a tmux session to a remote host
b) On the local host, run this (assuming session 0):
Despite using tmux for years, even having written scripts for nested sessions that I use each day, I hadn't noticed the CLI was missing long options. Kind of crazy.