I'm still having trouble figuring out how to call the framebuffer and network using a script, so I chose to takle something a little simpler, just to prove the concept of using the buttons to execute Pi commands. The TFT has a backlight that can be turned on and off, and there's a program called OctoPiPanel that can pretty easily be called by a script, so these are what I chose to control. I programmed the third switch to simply output a line of text to the terminal indicating that the switch had been pressed and what state the toggle was in.
I found a reference at https://github.com/jonaslorander/OctoPiPanel that showed me how to run OctoPiPanel. Once I had it installed I had to get the Octoprint API key and copy it to the OctoPiPanel.cfg file. Then I had to make OctoPiPanel executable. From that point, I can launch OctoPiPanel from a command line which I will later tie to one of the switches.
The next step was to create a python script that monitors the buttons. it uses RPi.GPIO to map the switches. I added some logic to create a two state state engine, so I can essentially treat each switch as an on-off switch even though they are only momentary. I mapped one switch to start and stop OctoPiPanel and another switch to toggle the LCD backlight. Finally, I modified the startup script /etc/rc.local to call my monitoring script.
Now I can toggle the backlight and run OctoPiPanel at the press of a button.
I published my work on GitHub here: https://github.com/TJEmsley/PiTFT-Button-Monitor