The first answer you’re going to get is that you can’t do that and it would ALMOST be right.
There is a conditional branch available in the macro api.
…allows you to place a macro on Button1 that you can be certain will only be activated when you have the alt key down (assuming you don’t actually press Button1 yourself), to place a macro on Button2 that you can be certain will only be activated when you have the control key down, to place a macro on Button3 that will only be activated when you have the shift key down, and to place a macro on Button4 that will only be activated when you have none of them down.
You can put ANY valid condition or set of conditions in there. You can chain them together in a single line like this:
Note that I was able to remove the “nomod” condition on the last one that way and got rid of a lot of characters by not duplicating "/click " unnecessarily.
This is a very powerful mechanism and I use it for managing my targeting and controlling my pets for every targeted attack on my hunter (I manage growl and misdirection, always have a current target, allow for retargeting, allow for situaitonal priority targets, and a few more things).
I have a short treatise on this as a free download on my Patreon page (no contributions are being accepted - this is just a legitimate place to house the file).
You can get to it here:
If you have question, please feel free to ask.
I will tell you that there are a (very) few minor issues with how those macros are constructed (I’ve improved them since I wrote that). But the concepts are sound.