Middle mouse button for pan in Photoshop

Hi, I'm currently using the trial version. I'm trying to configure the middle mouse button to work with Photoshop. I want clicking and holding the middle mouse button to simulate pressing the "H" key on the keyboard, followed by pressing and holding the left mouse button. This way, I can pan the view. When I release the middle mouse button, it should press the spacebar to revert to the last used tool. How can I achieve this?

try this:
middle-click-photoshop.bttpreset (6.9 KB)

It adds a middle mouse down and a middle mouse up trigger to the normal mouse section in BTT, then sends the appropriate actions.