This project is abandoned.

Whether this project is out of date or its author marked it as abandoned, this project is no longer maintained.

If you wish to take this project over, please report it and state your intentions.

1. Macro selects the nearest target and prepares to attack.

The addon creates a macro to guarentee we attack the nearest enemy mob or player. The addon uses a macro because Blizzard blocked addons from targeting and attacking a long time ago. The addon was originally created to fix the issues that '/targetenemy' normally has (see the features below).

The macro for the warrior, paladin, priest, deathknight, mage, warlock, rogue, shaman and druid classes.

   #show auto attack
   /run Dismount()

The macro for the hunter class, only targets and the attack is commented out. Unfortunately attacking casts the Auto Shot spell automatically which instantly aggros mobs at any range accidentally.

   #show auto attack
   /run Dismount()
   /cast hunter's mark


  • Guarentee we always attack the nearest enemy in front of the player
  • Never get stuck on a target far away, out of range, behind, or fleeing (has no modifiers)
  • Never get stuck on a friendly or dead target (like modifiers [noharm] [help] [dead])
  • Never tab target accidentally (like modifiers [@target])
  • Never toggle off the attack accidentally (see /startattack)
  • Always dismount to attack the nearest enemy regardless of the auto dismount option in the blizzard interface
  • Always clear the target and not stuck regardless of the sticky targeting option in the blizzard interface
  • Attack the nearest enemy in melee range or wait ready to attack mobs at range and not aggro yet
  • Attack the nearest enemy and not aggro mobs farther away causing a wipe
  • Attack the nearest enemy while still using a vehicle bar, bonus bar, etc
  • Easily see the action bar flashing so it is obvious we are about to aggro and start combat
  • Easily see the action bar stop flashing when we change our mind and rather not pull aggro accidentally
  • As usual, you can still tab target to cycle to different mobs and farther mobs

There are other macros on the web but they only do some of the features. Modifiers in a macro can also help do some of the features but can not do them all. The spells and slash commands Blizzard gave us to target and attack do have limitations, like the keybind 'Target Nearest Enemy', keybind 'Attack Target', slash /targetenemy, slash /startattack, API TargetNearestEnemy(), the auto attack icon from the spell book, etc.


  • 1. Open Blizzard's macro window
  • 2. Find the macro ATTACKNEARESTENE in the character tab created automatically after login.
  • 3. Add the macro icon to the action bar and assign a keybind, like the middle mouse button.
  • 4. Make any custom changes to the macro if desired. The macro is created only once by the addon and not erased.
  • 5. Now that we have the macro, the addon itself is not needed anymore for that character.


  • 1. Use the macro or press the keybind on the action bar when approaching enemy.
  • 2. See it target the nearest enemy in front of the player and ready to attack.


   /ane add
   /ane delete


  • Show help in the chat window,

  • Erase and add the default macro again, after confirming to proceed,
   /ane add

  • Erase and stop using the macro. There is no confirmation. Remember to erase the addon folder too so it does not create the macro later.
   /ane delete


  • In Windows XP, extract the ZIP file, to your World of Warcraft interface addons directory, which might look like, .\World of Warcraft\Interface\AddOns\AttackNearestEnemy
  • Free up at least one macro slot in the macro interface in the character tab so a macro can be added automatically by the addon.

UNINSTALL (for Windows XP):

  • Remove the game folder, .\World of Warcraft\Interface\AddOns\AttackNearestEnemy
  • Remove the macro ATTACKNEARESTENE


See the icon in the action bar flashing, in or out of combat, just like the Auto Attack spell. We are using the Auto Attack spell for display only. It is useless to actually cast the Auto Attack spell, because it cancels anyway when clearing the target later. It is also useless to cast the Auto Attack spell, because it can toggle off the attack. For warriors, we are not using the Attack spell, because it does not do anything special and does not flash anyway.

   #show auto attack

Dismount to immediately attack the nearest enemy you land on, instead of pressing the keybind for 'Dismount'. We do not want to just land and stay mounted while being attacked by the nearest enemy. We want to attack from a flying mount in midair even if we setup the Blizzard interface option to stop every other instant spell and ability from being auto dismount in flight. It helps later because staying mounted defeats the purpose of finding and attacking the enemy in the first place.

   /run Dismount()

Clear the target, instead of pressing 'Escape' the keybind for 'Toggle Game Menu'. It helps later because we can not rely on modifiers when targeting to handle all the features.


Target the nearest enemy, instead of pressing 'Tab' the keybind for 'Target Nearest Enemy'. It helps later because attacking has a delay and does not always find the nearest target by itself (see limitations below).


Attack a target in melee range, instead of pressing 'T' the keybind for 'Attack Target' or 'Start Attack'. The player also waits ready to attack if mob is at range and not aggro yet. Not recommended for hunters because it also casts the Auto Shot spell which instantly aggros mobs at any range. It can be used repeatedly and does not accidentally toggle off the attack, like the Auto Attack spell does. It can be used repeatedly and does not accidentally tab target. It can be used while jumping off a flying mount in midair and does not accidentally toggle off the attack.


Hunter's can mark the target since you will be attacking it anyway.

   /cast hunter's mark

Make any other custom changes to the end of the macro if desired that help prepare for the attack. For safety, to actually attack, aggro, charge or pull, should still be kept in your other macros and action bars. For example, preparing for attacks can include, reseting temporary bars, reseting temporary noncombat auras, etc.

   /changeactionbar 1
   /cancelaura crusader aura
   /cancelaura aspect of the pack

Known bugs:

  • None

Known limitations caused by Blizzard:

  • Distance is limited targeting up to 50 yards, which is a limitation of Blizzard.
  • Must be facing within 30 degrees of the target, which is a limitation of Blizzard.
  • Attacking will not be instantenous but is still relatively fast, which is a limitation of Blizzard. A delay occurs after clearing the target before /startattack can detect the current target state and ends up not actually attacking. We can at least use /targetenemy to help set the target state more quickly for /startattack to respond properly.
  • It will not automatically attack the next target once the current target dies due to a blizzard limitation. Use the macro or keybind again to acquire another target.
  • Enemy players flagged for pvp can be attacked and there is no option to prevent this.
  • Shaman totems can not be attacked and there is no option to allow this.

Regarding critters:

  • Critters can not be attacked but is okay since focus remains on more dangerous enemy mobs in instances, battlegrounds and quests in the world. Neutral level 1 critters with yellow nameplates are rats, rabbits, deer, etc.
  • Some critters can not be attacked when they should, like rats in the Stratholme instance even though they have red nameplates. I think it is because the rats are originally neutral critters before they get aggressive.
  • Some critters can be accidentally attacked like rats in the Icecrown daily quest areas. Not sure what that is about.

Change log:

(see "changes" section in website)


Date created
Sep 30, 2006
Last update
Jan 21, 2012
Development stage
All Rights Reserved
Recent files
  • R: 4.3.0b for 4.3.0 Jan 21, 2012
  • R: 4.3.0 for 4.3.0 Jan 15, 2012
  • R: 3.1.0 for 2.1.0 Apr 19, 2009
  • R: 1.44 for 2.1.0 May 24, 2007
  • R: 1.43 for 2.1.0 May 23, 2007