You need a conditional action with two decisions for each button. If you are on CP8, would recommend a shared action personally, and put it in a file that you can always reuse as external Library. For one button action will look like this:
There are multiple threads showing this same solution. And on my blog there are several use cases as well.