Wild charge macro?

Is it possible to make a macro that will do the following?

If enemy is targeted, Cast cat form and then wild charge
If friendly is targeted, Cancelform and then wild charge

#showtooltip Wild Charge
/cancelform [help]
/cast [harm,noform:2] Cat Form
/cast Wild Charge
1 Like

On a button keybound to mousewheel up:

#showtooltip
/cast [mod:alt, @cursor] Typhoon; [stance:2, combat, harm] WIld Charge; [stance:1] Cat Form; [stance:4] Cat Form; [noform, combat] Cat Form;  [nostealth, nocombat] Prowl; [stealth] Wild Charge

This puts me:
Into Prowl out of combat
Into cat in combat
wild charge to the hostile, if targeted and already in cat
Typhoon if I hold alt

On mousewheel down

#showtooltip
/cast [mod:alt, @cursor] Ursol's Vortex; [mod:shift, @mouseover] Entangling Roots
/cancelform [!noform,@target,help]
/cast [@target,help,noform] Wild Charge
/cast [@target,harm] Moonkin Form
/cast []Wild Charge

This puts me in caster, if a friendly is targeted
Wild charge to the friendly if in caster
Into Moonkin if hostile is targeted
Wild charge retreat if in moonkin
Entangling roots if shift is held
Ursol’s Vortex at cursor if alt is held

Love these two.

Optimized

#showtooltip
/cast [mod:alt,@cursor] Typhoon; [form:1/4] [noform,combat] Cat Form; [nostealth,nocombat] Prowl; [form:2,combat,harm] [stealth] Wild Charge
#showtooltip
/cancelform [nomod,form,help]
/cast [mod:alt,@cursor] Ursol's Vortex; [mod:shift,@mouseover,harm,nodead] [mod:shift] Entangling Roots; [harm] Moonkin Form
/cast Wild Charge