Someone else may do this differently, but my take on this is:

1) Create an ATG for your melee characters
2) Make a copy of the IWT Mapped Key that you normally use (e.g. whichever one is assigned to your team in the Virtual Mapped Keys tab of your Character Set)
3) Assign the melee-only ATG to the Targets of the freshly copied IWT Mapped Key
4) Add a "Do Mapped Key" Action to any of your rotation Mapped Keys (in Combat Hotkeys), and point it at that new Mapped Key

That's a pretty crude explanation, but those are the steps.