Automatic impedance matching in microwave waveguides
You can use a directional coupler to measure VSWR (reflected power). There are many app notes online for this: http://www.minicircuits.com/app/COUP7-2.pdf here is an example.

However, the fact is that waveguides need to be tuned because no two are exactly the same when you put multiple components together. This means you won't be able to just change the height a set amount to 'fix' the match. You could characterize each component and get a set of "heights" to adjust, but I would recommend trying to have a control loop where you are constantly measuring the reflected wave and tuning to minimize power.

And again, the VSWR is kind of a derived term and it will be best thought of as "tuning for minimal reflected power" when setting your system up.

And wowzers, I just saw that you have a WR340. Those are gonna be some hefty stubs!

edit: Do you really expect your match to be that dynamic? If not, you can just tune your waveguide piece on a network analyzer, epoxy/lock washer the screws and you'll have yourself a well matched piece.