Simple target enemy / cast spell macro

Hello,
I am looking for probably the simplest macro there is. Lately, I am constantly clicking off the boss or the enemy and have to retarget them with the tab key. I would like a macro that auto targets the enemy without cycling (like in a mob situation) then casts my spell.

/showtooltip
/targetenemy
/cast Mind Flay

Something like that, but only if the enemy is not dead. But then how does that work if I have the boss targeted and need to switch targets to the ads?

#showtooltip
/startattack
/cast Mind Flay
1 Like

Thank you very much! Will this also target ads when I need to switch off the boss?

Only if you don’t have a target.

Ok, thank you again!