#showtooltip [nopet] Call Pet; [target=pet,dead] Revive Pet; [modifier] Beast Training; Mend Pet
/cast [nopet] Call Pet; [target=pet,dead] Revive Pet; [modifier] Beast Training; [button:2] Dismiss Pet; [button:1] Mend Pet;
The #showtooltip part just displays the correct icon and tooltip depending on the situation. More importantly is what the macro actually does. If you have no pet with you, it tries to call your pet. If your pet is dead, it casts Revive Pet. If your pet is alive and at your side, the macro does certain things based on how you activate it. If you just click the macro normally with the left mouse button (pressing an assigned hotkey does the same thing), it will cast Mend Pet. If you right-click the macro, it casts Dismiss Pet. And if you press any modifier key (ALT, CTRL, SHIFT) while clicking on the macro, it brings up the Beast Training panel.
Why Beast Training? I find that between checking the skills my pet know, learning new pet skills, and training my pet, I bring up this window a lot. If you don’t, you could replace it with something else, say Feed Pet. I don’t need Feed Pet in this macro because I have Feed-O-Matic.
Notes: There is no icon and tooltip to be displayed for Dismiss Pet so remember what happens when you right-click. I haven’t yet tested out the Revive Pet part because none of my pets have died yet. If you have any problems with it, post a comment below.