Check the UI & Macros forum, I have a massive guide on all things macros (Macros: Essential Information). If you want a specific macro, post over there, I or one of the other macro people can help you write it (or tell you why its impossible or a terrible idea).
For Misdirection though, try this:
#showtooltip
/use [help,nodead][@focus,help,nodead][@TankName-TankServer,help,nodead][@pet,pet,nodead][]Misdirection
Will Misdirect, in order of priority:
- Your friendly Target, manually clicked on
- Your friendly Focus
- A friendly character named TankName-TankServer who must be in your group
- Your pet
- Default targeting - the cursor gets a blue highlight and you click on any unitframe after pressing the keybind to apply it to that person
If anything in the priority listing is either not there, dead, an enemy, or mind controlled, it will fall down to the next possible target in the list.