You need something which will interpret a button press and then initiate some sort of functionality. In my case, I wrote a driver which will listen for keypresses on the typical old Xbox 360 controller and then to do functionality within OctoPrint. I find that the preheat, homing and filament loading/unloading functions are the ones I used the most. I use it so much that I no longer really need or use the nifty TFT menuing system which I wrote for the embedded screen in mine.
Using the buttons to select a particular uploaded gcode file implies that you need to display them on the Nanomesher's screen. This means that you'll need to create and display a menu system on that screen for this to occur. Unless you're a programmer I would caution you against that approach. Try taking baby steps and marry the button presses first to actions within OctoPrint.
Review the REST API within OctoPrint. You will find the start/pause/cancel actions which are some of the activity you're looking for.