Need a Macro help

So i need something that instantly targets my nearest enemy without having to press tab.

I made this and used it for a bit, but it feel clunky as it clears the target and re targets if they are not near.

Sometimes in keys it is not helpful as I may need to cc.

/cleartarget
/targetenemy [noexists][dead]
/cast Blessed Hammer

What i need is something to target my nearest enemy without pressing tab. DO any of you use anything like this ?

Just go into keybinds and select which button you want to target things with.

I use the ~ key.

I always use this:

#showtooltip
/startattack
/cast Frostbolt

“/startattack” always targets the closest but will enable auto attack so don’t use it on a hunter unless you are good at not spamming.

Is this what you are looking for?

Used Chat GPT for this :

see if you like it. It works wonderfully on my Prot. Below is the explanation of how it works and a sample.

/targetenemy [noharm][dead]
/cast Blessed Hammer

Explanation:

  • /targetenemy [noharm][dead]: This line will target the nearest enemy if your current target is either not harmful (like a friendly target or no target) or dead. It will not clear the target first, so if you already have a valid target, it won’t change.
  • /cast Blessed Hammer: This will cast your spell after ensuring that you have a valid target.

What this does:

  • If you have a living, hostile target, it will keep that target.
  • If you don’t have a target, or your target is dead or not an enemy, it will target the nearest enemy.
  • You won’t lose your current target unless it’s invalid for combat, making it easier to control when you want to maintain a specific target.

This should feel smoother in scenarios where you need to maintain control over your target selection.

this might be a little off topic but i wanted to know if any changes were made to the basic
/tar or /target command? I was standing in front of the target i was looking for and the command just was not picking up. Anyone know whats going on? Please and Thank you.

I had the same issue. And this works a little bit better. Make sure you have interactive targeting option on.

/targetenemy [noharm][dead]
/startattack
/cast Shield slam