Mouseover + switch based on target?

I have a macro as below, which switch 2 skills based on if the target is friendly or enemy:
/cast [harm]Judgment;[help]Flash of Light;[nomodifier:target=player]Flash of Light
I have another macro as well which cast a skill to the mouseover target:
/cast [target=mouseover,exists] Flash of Light;Flash of Light
Now I would like to combine them together, could someone teach me how to do it?
Thanks in advance!

#showtooltip
/cast [mod:alt,@player] [@mouseover,help,nodead] Flash of Light; [@mouseover,harm,nodead] [harm] Judgment; Flash of Light
1 Like

That is exactly what I need!
Thank you so much!