Make your hotkey like this:

Mage: Button 2= fire ball
Druid: Button 2 = ingame macro /assist mage /cast wrath, or /cast [target=mage-target] wrath, or ./cast [target=focustarget] wrath.

Either way your above isn't really automation. 1 Button press for 1 action. Your action on the druid is doable by 1 ingame macro. Just change your ingame macro a bit and you're fine.