Is it possible to write macro to target units in sequence?

Hi due to a disability I play wow with a controller with console port.

However in m+ it’s rather hard to tab target into the right mob in time to interrupt something.

Is it possible to have a macro say “target mob A, if A is not within reach (dead), then target B etc for C D E etc”

Other any other general tips on how to target the specific mob. Many years ago when I played wow with keyboard and mouse I would just mouse hover on the mob nameplate.

/tar lowest_priority
/tar med_priority
/tar high_priority

Thanks. How does that work? Shouldn’t high priority come first?

Nah, it’ll try to target all of them, in order, and will keep going even if it finds one. So you want the highest prio last.

Sorry so how does this work? Say I start m+ and now we are at the first pull, I press this macro. Will it target the first interruptible mob in the first pull? But if I press it again it will target away from it and go to pull 2?

Just test it out in open world. Best way to understand how it works.