How do I set my graphics tablet to only draw when either of the pen buttons are pressed?

I am using Windows 10 home that came with my laptop. I just got a Veikk S640 to try my hand on sculpting faces and terrains.

In Blender you can create a new shortcut.
2020-01-14 14_37_08-Blender

However in other programs it might not be possible. There could be a possiblity that you would go to Windows settings and flip Left-Right mouse buttons. Which is a bit bothersome, not the perfect solution.

I tried also doing it with Autohotkey and it worked only for mouse. The Pen Tablet did not work at all as intended.