Useful macros (old)

These macros have not be validated as working in patch 3.1 or later. These macros may no longer function as expected.
== General ==
For more info on the new macro syntax introduced in Patch 2.0, see HOWTO: Make a Macro.
===One-click Northrend dailies===
 /use item:42246
 /use item:42164
 /use item:40946
 /use item:34127
 /use item:42480
 /use item:40587
 /use item:43147
 /use item:43101
 /use item:43149
 /use item:43142
 /use item:35506
 /use item:38566
 /use item:38556
 /use item:38544
 /use item:38574
 /use item:42479
This macro has the Ebon Blade Banner, Darkmender's Tincture, Hodir's Horn, Essence of Ice, Raelorasz's Spear, Dalaran cooking dailies (ie:the stewpots), Steel Spade, Incinerating Oil, Argent Crusade Banner, High Impact Grenade, Ethereal Worg's Fang, Anuniaq's Net and Tasty Reef Fish. Please feel free to request in the discussion page other dailies you would like to see added here, and anything you find wrong with this daily. Hotkey this and enjoy never searching your bags for your quest items that need using every day. 255 characters exactly!
*Removed because Wrath of the Lich King ended long ago.
===Show/hide cloak===
 /run ShowCloak(not ShowingCloak())
*Use: Shows or hides your cloak.
*Works in 4.x
*Removed because the new transmog system in Legion made the old way of showing or hiding your cloak obsolete.
===Show/hide helm===
 /run ShowHelm(not ShowingHelm())
*Use: Shows or hides your helm.
*Works in 4.x
*Removed because the new transmog system in Legion made the old way of showing or hiding your helm obsolete.
===Switch language===
 /run c,d,i,p=DEFAULT_CHAT_FRAME,GetDefaultLanguage,GetLanguageByIndex,player;l=(d(p)==i(1) and 2 or 1);if c.editBox.language~=d(p)then c.editBox.language=d(p)else c.editBox.language=i(l)end;c:AddMessage("Language set to : "..c.editBox.language);
*Credit: Yza @ EU-Ysondre
*Use: Intelligent switch between default and racial language
*Warning: Generates a LUA error when used with a Human/Orc (no racial language)
*Works in 7.3.5
*Removed because someone wrote an improved version that doesn't throw a LUA error when used on a race with only 1 language.
== Where Am I? ==
 /script local px,py=GetPlayerMapPosition("player"); print(format("%s (%.1f, %.1f)",GetZoneText(),px*100,py*100))
* Use: Prints your current location in your zone to your chat frame, with one decimal place precision (that's the "1" in "%.1f").
* Works in 3.3.0.
== Attack / Shoot / Throw ==
 #showtooltip [nomodifier] attack; [modifier] Shoot (or Throw)
 /startattack
 /cast [modifier] Shoot (or Throw)
This will act like a normal Attack button, except that it won't toggle autoattack off in combat (hit escape if you need to do that). It will also show your current weapon when assigned to a quickslot. You may want to leave out the references to Shoot or Throw, or perhaps make them more precise by using [modifier:shift] or some such, depending on your style of play.
#showtooltip
/cast [equipped:Fishing Pole] Fishing; [equipped:Thrown] Throw; Shoot
The above will attempt to shoot, throw or even fish (depending on what you have equipped) For Hunters change "Thrown" to "Gun" "Crossbow" or "Bow", remove "Throw" and change "Shoot" to "Auto Shot".
 #shoot
 /cast !Shoot
This macro will start shooting wand, but will not toggle it off.
== Keeping space, switching actions ==
=== Template ===
This principle is for those of us who like to keep buttons as few as possible or to bind as much actions as possible.
 #showtooltip
 /cast [combat] [harm,nodead] <Badass spell>
 /cast [target=mouseover,help,nodead,exists] [help,nodead] [] <Fluffy spell>
or
 #showtooltip
 /cast [mod:ctrl,target=player] [target=mouseover,help,nodead,exists] [help,nodead] <Fluffy spell>
 /cast [harm,nodead] <Badass spell>; <Fluffy spell>
will select actions based on the situation.
The first template is better to combine with exclusively non-combat beneficial spells and items, like Arcane Intellect or food & water (see below). The second template is better for use with beneficial spells which you're likely to use in combat (any heal or blessing, for example). The icon will allow you to see what exactly you're going to cast. Note that you can cast the beneficial spell on yourself by mouseovering the player frame, so "mod:ctrl" (or "alt") condition can better be used to modify the spells (example below).
=== Direct damage / buff spell ===
 #showtooltip
 /cast [nomod:ctrl,harm,nodead] Fireball, [mod:ctrl,harm,nodead] Pyroblast
 /cast [target=mouseover,help,nodead,exists] [nomod:ctrl,help,nodead] Arcane Intellect
 /cast [mod:ctrl,help,nodead] Arcane Brilliance
This convenient macro will cast Fireball / Pyroblast (depending on whether or not "Ctrl" was pressed) on a harmable target, Arcane Intellect on selected or mouseovered friendly target (mouseover the player frame to buff yourself), and Arcane Brilliance on a friendly target if "Ctrl" was pressed.
=== AoE harmful / direct beneficial ===
 #showtooltip
 /cast [target=mouseover,help,nodead,exists] [help,nodead] Flash of Light
 /cast [nomod:ctrl] Consecration; [mod:ctrl] Consecration(Rank 1)
Since AoE spells are often used to search for rogues, they require a template which will force them to be used under any circumstances except when something friendly is mouseovered or directly targeted.
=== Combat spell / food & drink ===
 #showtooltip
 /cast [combat] [harm,nodead] <Combat spell>
 /use <Water>
 /use <Food>
A very good use for these macros is to put food & water on them so you'll never have to click something by mouse when grinding!
Some of these macros have not yet been tested directly but the overall principle works.
==Parties==
===Announce Vent in Party===
 /party My Guild Vent | abc.leetvent.com
 /party My Guild Vent | 1234
 /party My Guild Vent | secretpassword
 /party Normalize Vent - http://some.vent.server/somewhere
 /threshold rare
* Use: Announces your Vent details to your party, sets your loot threshold Rare if you are the leader.
* Works in 3.1.1
* Consolidated the Raid and Party versions into one macro that uses /i (Instance chat), also set to to show Discord, which is the biggest voice chat app today.
==Raiding==
===Announce Vent in Raid===
 /rw Vent Details Posted
 /raid My Guild Vent | abc.leetvent.com
 /raid My Guild Vent | 1234
 /raid My Guild Vent | secretpassword
 /raid Normalize Vent - http://some.vent.server/somewhere
 /threshold epic
 /master player
* Use: Announces your Vent details to your raid, sets your loot threshold Epic master looter (with yourself as the master looter) if you are the leader.
* Works in 3.1.1
* Consolidated the Raid and Party versions into one macro that uses /i (Instance chat), also set to to show Discord, which is the biggest voice chat app today.
== Targets ==
=== Swap focus / target ===
 /stopmacro [noexists][target=focus,noexists]
 /target focus
 /targetlasttarget
 /focus
 /targetlasttarget 
For more information about the focus and how to use it, see Focus target.
=== Advanced swap focus / target ===
 /focus [target=focus, noexists]
 /target [combat, noexists] focus
 /clearfocus [nocombat, noexists]
 /stopmacro [target=focus, noexists]
 /target focus
 /targetlasttarget
 /focus [exists]
 /targetlasttarget
Sets the focus if you don't have one; clears the focus if you're out of combat and don't have a target; targets the focus if you're in combat and don't have a target; otherwise swaps the target and focus.
=== Acquire focus target / toggle between previous target ===
 /clearfocus [modifier:ctrl]
 /targetlasttarget [modifier:shift]
 /stopmacro [target=target, dead]/[modifier:shift]
 /focus [target=focus, noexists]/[target=focus, dead]
 /stopmacro [modifier:ctrl]
 /target focus
How to use: If no target=does nothing. If you have a target but no focus target, it makes target focus target. Once focus target is acquired and current target is anything but focus target= switches active target focus target. Hold down Control + activate = replaces focus target with current target (or clears if no current target). Hold down shift + activate = toggles between current target & last target.
Replace either ctrl or shift with alt if that modifier key works better for you. Also, it will not let you add a focus target that is dead. If you want to focus corpses just delete the "[target=target, dead]/" from line 3 and "/[target=focus, dead]" from line 4.
=== Cast on moused-over unit ===
 /cast [target=mouseover, exists][] Name Of Spell
The player or mob that is under your mouse pointer will be the one that is hit or healed by your spell. If there is nothing there, your selected target will be used.
=== Crowd Control stays on 1 mob ===
Macro Behavior 	Macro Behavior
"First use" or right-click	Marks the mob as your "focus" and attempts to control it.
Until focus is dead 	Attempts to control the focus without changing targets.
No target 	Cancel the focus; next cast will be the "first use".
 /focus [target=focus, exists, nodead] focus; [btn:2][] target
 /cast [target=focus] Shackle Undead
Replace Shackle Undead with a spell name appropriate to your class.
The purpose of this macro is to eliminate micro-management of CC. Once a target is identified for control, another target may be selected for healing or damage, and the controlled target will be the victim of renewed control until it is dead.
It is common for people to add a shout (e.g.: /y Controlling >>%t<<... You spank it, you tank it!) to warn off would-be sheep-breakers.
=== Raid icons, Lucky Charms ===
 /script SetRaidTarget("target", n)
where n is:
# Yellow 4-point Star
# Orange Circle
# Purple Diamond
# Green Triangle
# White Crescent Moon
# Blue Square
# Red "X" Cross
# White Skull
and 0 is no icon. It's more helpful when used in the same macro call as preparing to sheep (when you as mage are leader) and other CC preps. Alone, this command line isn't that useful unless with a key binding, since you can just rightclick the unit frame to change the icon.
=== Lucky Charms with Mouseover ===
 /script SetRaidTarget("mouseover", n)
Combined with key bindings, this macro makes for extremely fast marking. See above for corresponding values for "n."
=== Tank assist macros ===
 /focus [modifier:shift] target
 /target [modifier:alt] focus
 /target [nomodifier:shift/alt] targettarget
This macro sets the focus with shift-button, targets it with alt-button, and targets the target of the focus with the button itself. Useful for DPS trying to target what the tank is targeting in a pack, or just to keep track of a polymorphed target.
or:
 /focus [modifier:alt]
 /stopmacro [modifier:alt]
 /cleartarget
 /assist focus
Begin by selecting the MT/MA and then click the assist macro with the alt pressed.
If no Focus (MT/MA) has been set and the macro is clicked, you will receive a UI message stating "Unknown Unit."
If you have set your Focus and just click the macro, you will assist the MT/MA and target his or her target.
== Bandages ==
=== Heavy Netherweave Bandage on self ===
 /use [target=player] Heavy Netherweave Bandage
This macro will always use Heavy Netherweave Bandages on yourself, regardless of target.
=== Heavy Netherweave Bandage friendly then self ===
 /use [help,nomodifier:alt] Heavy Netherweave Bandage; [target=player] Heavy Netherweave Bandage
This macro will use a Heavy Netherweave Bandage on your target if you can, yourself otherwise.
If you hold down ALT, you will always bandage yourself.
=== Specify target by modifier key ===
 /use [modifier:alt,target=player] Heavy Netherweave Bandage
 /use [modifier:ctrl,target=pet] Heavy Netherweave Bandage
 /use [help] Heavy Netherweave Bandage
# If you Click the macro while holding down the ALT key, you will bandage yourself.
# If you Click the macro while holding down the CTRL key, you will bandage your pet.
# If you Click the macro by it self, you will bandage a friendly target.
== Bags and money ==
=== Sell all grey items ===
 /script for bag = 0, 4 do for slot = 1, GetContainerNumSlots(bag) do local name = GetContainerItemLink(bag,slot) if name and string.find(name,"ff9d9d9d") then DEFAULT_CHAT_FRAME:AddMessage("Selling "..name) UseContainerItem(bag,slot) end end end
=== Mail all green items (Good for mailing greens to be disenchanted) ===
 /run for bag=0,4 do for slot=1,GetContainerNumSlots(bag) do local texture,itemCount,locked,quality=GetContainerItemInfo(bag,slot) if quality==2 then UseContainerItem(bag,slot) end end end
The mailbox must be open on the Send tab (preferably with a To: name typed in) to use this.
=== Get all money from mail items (Good for Auction House sales) ===
 /script CheckInbox() for m = GetInboxNumItems(), 1, -1 do TakeInboxMoney( m ) end
If there is any money in any of your mail messages it will be collected. As for the Auction House messages, once the money is collected the message will be removed. Your mailbox must be open before the script will work.
=== Get all items from mail (edit of macro above) ===
 /script CheckInbox() for m = GetInboxNumItems(), 1, -1 do TakeInboxItem( m ) end
This macro will remove any items in your mailbox. Your mailbox must be open before the script will work.
=== Swap carried & bank bags ===
 /script PickupInventoryItem(20) PickupInventoryItem(71)
 /script PickupInventoryItem(21) PickupInventoryItem(70)
 /script PickupInventoryItem(22) PickupInventoryItem(69)
 /script PickupInventoryItem(23) PickupInventoryItem(68)
Use: Swap your four bags with the first four bags in the bank. You have to be in the bank and open the window before you use the macro. It is very helpful if you have bags with your tools and other stuff you need for your jobs.
=== Open all bags ===
 /script OpenAllBags()
This macro opens all bags, the same as pressing shift-B in the default keybindings. Useful if you want to put a button for this on an action bar.
=== Open all bags but leftmost one ===
 /run o=OpenAllBags c=CloseAllBags i=IsBagOpen cw=CloseBag if i(0) and i(1) and i(2) and i(3) and not i(4) then c() cw(0); else if i(0) or i(1) or i(2) or i(3) or i(4) then c() cw(0) o() cw(4) else o() cw(4) end;end
One could find this macro useful if playing as a Warlock and wanting to open all bags at once but the SoulBag.
Please note: My SoulBag is the leftmost one but one can easily replace the code in the script above to leave closed whichever she prefers.
Background information: In v2.3.3.7799 the "CloseAllBags" function is buggy: under certain conditions, it ignores the backpack. This fact led the macro author to create a longer macro than he would have preferred.
== Quests ==
=== One-click Skyguard / Ogri'la / Netherwing dailies ===
 #show [mounted]Skyguard Bombs; Fel Gland
 /use [mounted]Skyguard Bombs
 /use [mounted]Skyguard Blasting Charges
 /target [mounted]Diso
 /use [mounted]Booterang
 /stopmacro [mounted]
 /use Banishing Crystal
 /use Yarzill's Mutton
 /use Wrangling Rope
These are all items used in the pre-2.4 daily quests put together in a single button. If you choose the Question Mark for the icon, it will show while mounted and the number of you have while dismounted. It won't show the cooldown on the blasting charges nor the number of Apexis Shards you possess - unless you change the #show line, of course.
Note that this will not work for druids in flight form.
=== One-click Shattered Sun Offensive dailies ===
 #show [mounted]item:34475;item:34338
 /use item:34414
 /use item:34533
 /use item:34368
 /use item:34338
 /use item:34255
 /use item:34248
 /use item:34500
 /use item:34483
 /use item:34475
 /use 1
 /use [btn:2]item:34489
There are so many quest items associated with Quel'Danas dailies that they all had to be converted to item ID format to save space. If you choose the Question Mark for the icon, it will show while mounted and the number of you have while dismounted.
The macro normally attempts to use every item available to the quests except Flaming Oil. To use the oil, right-click the macro button instead. (If you prefer the ALT key, change btn:2 to mod:alt.) This distinction was made due to the oil's ability to override Arcane Charges.
Equipment of Multiphase Spectrographic Goggles has also been omitted from the macro since it would become equipped too early, and decrease player stats for the other dailies. Here are the omitted lines, but they make the macro too long. Remove any 1 quest that you prefer to skip, and replace /use 1 with:
 /equip [mounted]item:35233
 /use 1
 /equip [noworn:1]item:#####
... where ##### is the item number of your standard helm. Be sure to use the macro as you fly into Nagrand.
=== List objectives ===
 /script i = GetNumQuestLeaderBoards(); for j = 1, i, 1 do a1, a2, a3 = GetQuestLogLeaderBoard(j); SendChatMessage(a1, "PARTY"); end;
Use: Sends your current quest objectives to party chat. This way, you don't have to constantly type to party members how many of each creature you need to complete a quest.
bugged: always displays the first item, even if it's not being tracked.
=== Bypass turn-in dialogue ===
 /script SelectGossipAvailableQuest(1)
 /script SelectGossipActiveQuest(1)
 /script CompleteQuest()
 /script SelectGossipOption(1)
 /script AcceptQuest()
 /script GetQuestReward(1)
This macro will do the following: Attempt to bypass any initial dialogue with an NPC (such as a banker or flightmaster, or any NPC with only one quest available), Select the first quest reward available (can be dangerous if you get too addicted to this macro), Turn in a quest. Credit goes to www.Feign.org from back in the halcyon days of CC Rep farming when it was possible to get a quest done twice in one go - with a fast mount and mad skills.
Do not add the command /startattack no matter how tempting it is, you'll inevitably find yourself turning in a quest in a neutral town with an opposing-faction player standing in close proximity behind the quest NPC - with hilarious consequences. Add the line /cast [insert skill/spell of choice here] at the end of macro to make it truly vital. The druid version, for example, casts Faerie Fire or Faerie Fire (Feral) depending on whether the druid is in form or not.
=== Automatically Abandon the First Quest in the Quest Log ===
This macro can be used to abandon a quest without clicking the abandon button and confirming your decision. It's most useful to perform this repeatedly to clear out your quest log.
 /script SelectQuestLogEntry(1); SetAbandonQuest(); AbandonQuest();
== Drinking ==
=== Mana Potion / Water ===
This macro will use a mana potion if you're in combat, or your favorite beverage when not in combat. Use the icon and it will show which one will be used. Substitute your item names:
 /use [combat] Super Mana Potion; [nocombat] Filtered Draenic Water
=== Water / Manna Biscuit ===
This will use Purified Dranic Water on normal click and Conjured Manna Biscuits on shift-, alt- or ctrl-click if found in your inventory.
 #showtooltip
 /use [nomodifier]Purified Draenic Water; [modifier] Conjured Manna Biscuit
This macro will use your Manna Biscuits if you have any, if not will use your Naaru Rations.
 #showtooltip Naaru Ration
 /use Conjured Manna Biscuit
 /use Naaru Ration
=== Mana / Healing / Dreamless Sleep Potions ===
This macro will use a Super Mana Potion with a normal click, a Super Healing Potion with a alt- click or a Major Dreamless Sleep Potion with a ctrl- click. You can change the potions to whatever suits you best.
 /use [nomodifier]Super Mana Potion; [modifier:alt ] Super Healing Potion;[modifier:ctrl] Major Dreamless Sleep Potion
== Racial abilities ==
=== Forsaken ===
==== One-key Will of the Forsaken and Cannibalize ====
This macro will use Will of the Forsaken if in combat, or Cannibalize if not in combat: 
 #showtooltip
 /cast [nocombat,mod:alt] Will of the Forsaken
 /cast [combat,mod:alt] Cannibalize
 /cast [combat] Will of the Forsaken
 /cast [nocombat] Cannibalize
Notice that holding down the alt button will reverse the abilities, letting the user execute Will of the Forsaken outside of combat or Cannibalize inside of combat. This manual override is included because though Will of the Forsaken is mostly a combat ability and Cannibalize is a non-combat ability, there are times when it is useful otherwise. For example, if a mob fears the player just before dying, the combat condition might be cancelled but the player runs the risk of inadventently moving into the aggro range of another mob and adding. Likewise, during a particularly long encounter a player may need to break from combat and Cannibalize to regain health while the rest of the party is still engaged.
== Cooking ==
This consolidates the cooking button, and creating a fire. This is separated with simple left/right-click logic.
 #showtooltip Cooking
 /use [button:1] Cooking
 /cast [button:2] Basic Campfire
==Fishing==
====Two Modifier Swap====
 /equip [noequipped:Fishing Poles, nomodifier:alt] Seth's Graphite Fishing Pole
 /equip [modifier:alt] Mana Wrath
 /equip [modifier:alt] Lamp of Peaceful Radiance
 /cast [equipped:Fishing Poles, nomodifier:alt] Fishing
This macro is handy in that on a regular click (or hotkey press) it will equip your fishing pole (simply change Seth's Graphite Fishing Pole to the name of whichever pole you use), and when pressed again will begin fishing. On an alt-click (or alt+hotkey) it will re-equip your normal weapon(s). If you use a two hand weapon, simply take out the third line and change Mana Wrath to your own main weapon, otherwise if you use two change Mana Wrath and Lamp of Peaceful Radiance to your own particular weapons. This macro also avoids any error messages from popping up. You could also add to this macro to have it swap out a Lucky Fishing Hat or gloves with the fishing enchant as well, if you had them.
====2H Coordinate Swap 1====
Another, more simple, fishing macro is this: 
 #showtooltip Fishing
 /cast [button:1] Fishing
 /use [button:2] x y
Replace x and y with the container location of your fishing pole (bag slot and item slot respectively.) A right-click will equip or unequip a fishing pole, and a left click will cast a lure. Note though that this macro only works with two-handed weapons and not a single-handed weapon and an offhand item, shield, or weapon; if you are going to use other than a two-handed item, use the first macro.
====2H Coordinate Swap 2====
Here is a more elaborate version:
 #showtooltip Fishing
 /equip [noequipped:Fishing Poles, nomodifier:alt] x y
 /equip [modifier:alt] x y
 /cast [equipped:Fishing Poles, nomodifier:alt, nomodifier:ctrl] Fishing
 /use [modifier:ctrl] x z
 /use [modifier:ctrl] 16
It will equip your fishing pole if not equipped, or cast Fishing. If you hold alt it will equip your weapon. If you hold ctrl it will use a fishing lure. The bag number is x, y is the slot your fishing pole is in, z is the slot for the lures. Again this works best if you have a two-handed weapon.
====Outfitter + Coordinate Swap====
Here is a complete fishing macro that utilizes the Outfitter add-on:
 #showtooltip [mod:shift] 4 17; [mod:ctrl] 4 13;Fishing
 /cast [equipped:Fishing Pole, nomod:shift, nomod:ctrl] Fishing
 /use [mod:shift, equipped:Fishing Pole] 4 17
 /use [mod:shift, equipped:Fishing Pole] 16
 /stopmacro [nomod:ctrl]
 /outfitter toggle Fishing
Where x y and z i are the bag locations of your lure and your pole, respectively. With no modifiers and a fishing pole equipped, this will cast fishing. With shift held and a fishing pole equipped, it will use your lure. With control pressed, it will toggle the "Fishing" outfit using Outfitter, which will automatically unequip your fishing outfit if you enter combat.
=== Count fish ===
 #show Speckled Tastyfish
If you want to keep track of how many of a specific kind of fish you have, use the icon and this macro.
===Autolure===
This macro is useful to automatically set a lure to your fishing pole, if you're a using a shortcut to /cast fishing.
 /cast Lure
 /equip Pole
 /cast Fishing
If no lure is active, then it'll cast one, if a lure is active, then it'll simply just fish.
Change Lure to the name of whichever lure you are using and Pole to the name of whichever pole you are using.
== Announce resurrection target ==
 /run R=R or CreateFrame("Frame")R:RegisterEvent("UNIT_SPELLCAST_SENT")R:SetScript("OnEvent",function(R,E,T,T,T,T)SendChatMessage("Rezzing "..(T or UnitName("mouseover")),"YELL")R:UnregisterEvent(E)end)
 /cast Rebirth
This macro yells out the intent to resurrect someone ("Rezzing Name", or Corpse of Name if released) as the spell is cast. Coordination of rezzers saves mana and time, especially after a raid wipe.
Rebirth is the druid rez; it leaves you with 40 letters to improve upon the message. The longest-named rez in the game, Ancestral Spirit, leaves 31 letters.
It may be possible to find an AddOn that does the work of this macro - however, it was not always possible to identify a ghost player with a spell. Many rezzers have been witnessed making the bizarre claim "Rezzing <no target>".
== Toggle gathering ==
 /castsequence [nocombat] find herbs, find minerals
Simple macro now that changes between Find Herbs, Find Minerals - bind it to a mouse key and you can change it every few second or so as you run along.
For hunters, warlocks, druids and paladins it is easy to add in the other tracks, or make your own. Simply substitute for one of the finds below, or add on to the end, separated only by a comma. I have included some examples here.
The [nocombat] check in the macros is so you don't accidentally trigger a global cooldown in combat.
 /script T,F=T or 0,F or CreateFrame("frame")if X then X=nil else X=function()local t=GetTime()if t-T<3 or not IsMounted() or UnitAffectingCombat("player")then return;end;SetTracking(t%2+1)T=t end end F:SetScript("OnUpdate",X) 
Macro that allow you alternate tracking automatically,once active tracking herb and tracking mine will be alternated every 3 sec,it will be inactive if you run this macro again.
This macro will not active if you are mounted or in combat,you can delete [or not IsMounted()]or[or UnitAffectingCombat("player")] to have it be active when you are mounted and in combat
== Follow with emote ==
 /follow
 /script if UnitIsPlayer("target") and UnitIsFriend("player","target") and CheckInteractDistance("target",4) and not IsControlKeyDown() then SendChatMessage("is following "..UnitName("target")..".","EMOTE") end
This macro is equivalent to following a unit - like using the "/f" command - and typing "/me is following %t."
If /follow is likely to fail or the control key is down, there is no emote.
==Battleground==
 /yell "%n, stop running so I can heal you!"
This is a simple macro for a healer in a battleground. Often your heal targets will be running away from battle, so you must tell them to stop running.
== Battle map ==
 /script BattlefieldMinimap_LoadUI() if BattlefieldMinimap:IsVisible() then MiniMapBattlefieldFrame.status = ""; BattlefieldMinimap:Hide() else MiniMapBattlefieldFrame.status = "active"; BattlefieldMinimap:Show() end
This macro will toggle the battle map in every region, just like in the battlegrounds and the areas with outdoor pvp. Take care to combine lines 2 through 4 as shown above into a single line (put a space at the end of each line and remove the linebreak).
Shift- M toggles the battlemap for all zones without the need for this macro.
There is also an option in the menu <esc> <Interface Options> to control default settings of the battlemap.
== World map ==
 /script ToggleFrame(WorldMapFrame);
This macro will toggle the world map, just like pressing "M" with the default keybinding. The ToggleWorldMap() API apparently does not work in a macro. Useful if you want to put a button for this on an action bar.
While these macros are useful for switching weapons with different names, if you have 2 weapons with the same name, which often happens when you wish to have different enchants, WoW will not know which you are referring to using a name or an item ID. This is remedied by using a mod like Baud Gear which keeps track of individual pieces of gear.
== Easy equip off-hand ==
See the top section for an offhand swapping macro.
 /equipslot 17 *Your weapon name*
Use: Equips the weapon you choose into your off-hand instead of your main, so you can switch back and forth between 2-Handed/1-Handed+Shield sets and Dual Wielding easily. (Select the question mark for your picture, so the icon is your weapon of choice.)
 /equipslot [equipped:Two-Hand] 16 *One-Hand Weapon name*
 /equipslot [equipped:Two-Hand] 17 *Shield name*
 /equipslot [equipped:One-Hand] 16 *Two-Hand Weapon name*
Above macro allows you to quickly interchange your One-Handed+Shield with Two-Handed weapon. When One-Hand+Shield is equipped it will equip Two-Handed weapon and viceversa. Select the question mark for your picture, so the icon is your weapon of choice. Change the names of weapons and shield to the ones you currently use. If you wish to use Dual-Wield instead of One-Hand+Shield just change the second line to the weapon instead of the shield
 /equip [equipped:Two-Hand] *DPS One-Hand Weapon name*
 /equip [equipped:Two-Hand] *Off-Hand Weapon name*
 /equip [equipped:One-Hand] *Tanking Weapon name*
 /equip [equipped:One-Hand] *Shield name*
 /equip [equipped:Shields] *Two-Hand Weapon name*
This macro will cycle through three sets of weapons (NOTE: If you use the same main-hand weapon for both DPS and Tanking the third line is not necessary)
Cycle (Starting with Two-Hand equipped):
*Cycles to Dual Wield weapons
*Cycles to Tanking weapon + Shield
*Cycles to *Two-Hand weapon
Note: Will "double switch" trying to re-equip tanking weapons prior to Two-Hand. At the moment, I don't know how to check for One-Hand weapon in Off-Hand slot (if I did this "double switch" would not exist as that would be the requirement for equipping a shield.
Possible Work around is to configure this to Cntrl Alt Shift and/or no modifier
 /equipslot [modifier:alt] 17 *Shield name*
 /equipslot [modifier:alt] 16 *One-Hand Weapon name*
 /equipslot [nomodifier] 16 *Two-Hand Weapon name*
 /equipslot [modifier:shift] 17 *Offhand Weapon*
 /equipslot [modifier:shift] 16 *MainHand Weapon name*
== Use or swap trinket ==
 #showtooltip
 /use [nobutton:2] Z
 /equipslot [button:2] Z X Y
This will use the trinket in slot Z, unless you click button 2, in which case it will equip the trinket at bag coordinates X,Y. Useful for engineers with multiple trinkets on separate cooldowns (i.e. Goblin Mortar and Goblin Dragon Gun in slot 13, Goblin Bomb Dispenser and Mithril Mechanical Dragonling in slot 14).
== Use either trinket ==
This macro activates the upper trinket if it is not on cooldown. If it is on cooldown, the macro tries to activate the lower trinket. This is useful if you have two trinkets on short cooldowns that do similar things (add attack power, add spell damage, add healing, etc.). You will get an error that one item is not ready every time you use this macro.
 /use 13
 /use 14
Here is another example using /castsequence and setting the reset timer to your primary trinket's cooldown. When you use the first trinket (use the '?' icon!) you will see the icon switch to your second trinket. If you use your second trinket or wait the reset time it will switch back to your primary trink. Like above, this is useful for trinkets that do similar things, as shown in this example.
 /castsequence reset=90 Bladefist's Breadth, Blackhand's Breadth
Another version of this macro is this: 
 /use [button:1] 13
 /use [button:2] 14
This macro is useful if you have trinkets that do dissimilar things. Left-clicking the macro will use the first trinket, right-clicking the macro will use the second trinket.
This example disables the annoying sound you get when your trinkets are on cooldown (credit to Syrloin on Steemwheedle Cartel):
 /run SetCVar("Sound_EnableSFX","0")
 /use 13
 /use 14
 /run SetCVar("Sound_EnableSFX","1")
 /castsequence X, Y, Z
This is the same as the previous one but also disables the red error messages. In addition, the sound issue can be solved with fewer characters leaving you with extra characters for those long spell names. And the icon and tooltip of the substantive spell will be shown.
 #showtooltip Spellname
 /run UIErrorsFrame:UnregisterEvent("UI_ERROR_MESSAGE")
 /console Sound_EnableErrorSpeech 0
 /use 13
 /use 14
 /cast Spellname
 /run UIErrorsFrame:RegisterEvent("UI_ERROR_MESSAGE") 
 /console Sound_EnableErrorSpeech 1 
This next macro moves the spellcast to the end, outside of the sound toggling. This allows the "that spell is not ready yet" warning if the final spell is indeed not ready, but still prevents the voice emote for the trinkets. As an alternative to managing the UI_ERROR_MESSAGE event to suppress the error messages on the trinkets, you can call UIErrorsFrame:Clear(), but this will have the side effect of clearing any previous error messages. 
 #showtooltip Mind Blast
 /run UIErrorsFrame:UnregisterEvent("UI_ERROR_MESSAGE")
 /console Sound_EnableErrorSpeech 0
 /use 13
 /use 14
 /run UIErrorsFrame:RegisterEvent("UI_ERROR_MESSAGE") 
 /console Sound_EnableErrorSpeech 1
 /cast Mind Blast
For offensive spells, the following line can be added at the top to prevent trinket use if there is no target selected, or the target is dead or not an enemy.
 /stopmacro [noharm] [dead]
==Interface (How to find hidden program information)==
Some AddOns include a library that provides the /print command. When the command is available, it can replace any DEFAULT_CHAT_FRAME:AddMessage( <code> ) phrase in a macro with /print <code>.
=== Get itemNumber (Used to shrink a macro) ===
 /script local infoType, info1, info2 = GetCursorInfo(); if infoType == "item" then DEFAULT_CHAT_FRAME:AddMessage( info1 ); end
This macro uses the script language to obtain the item number of what is on the cursor and displays it in the chat window. Assign the macro to a hotkey, pick up an item with the cursor, and hit the hotkey of the macro to see the item's number. This is useful for shortening macros by replacing long item names with item:#####.
=== Get frame name ===
 /script DEFAULT_CHAT_FRAME:AddMessage( GetMouseFocus():GetName() );
You can bind this macro to a hotkey, then hover your mouse over a frame and press this macro, and the name of the frame under your mouse will go to the chat frame. This is mostly useful to help identify AddOns that are making odd frames on the screen.
=== Get icon name / "texture" ===
 /script local type, id, book = GetCursorInfo();DEFAULT_CHAT_FRAME:AddMessage((type=="item") and GetItemIcon(id) or (type=="spell") and GetSpellTexture(id,book) or (type=="macro") and select(2,GetMacroInfo(id)))
Assign the macro to a hotkey, pick up an item, spell, or macro with the cursor, and hit the hotkey of the macro to see the filename of the object's image. The filename is relative to the World of Warcraft installation folder, and may not actually be 'there' on your hard drive since the program has a virtual directory system. This is useful only to programmers and those curious enough to ask.
==Profession Macros==
===Easy Milling/Prospecting===
 #showtooltip
 /script SetCVar("AutoLootDefault", 1)
 /cast Milling
 /use Herb A
 /use Herb B
 /use Herb C
 /in 1 /script SetCVar("AutoLootDefault", 0)
*Replace Milling with Prospecting for Jewelcrafters.
*Replace "Herb A" "Herb B" "Herb C" with the Herbs/Ores you wish to use. You can add more or less, just follow the same format.
*You can remove the script lines if you already have autoloot on by default.
*If the first Herb of the type selected is a stack of 4 or less an error message will appear stating "Need 5 Herb A" This can be fixed by either banking odd herbs or moving them to the end of your bags.
===Easy Borean Leather===
This macro was made by Pyroshen of Wowhead. Just spam this macro and you'll make a few Borean Leather from Borean Leather Scraps.
/use Borean Leather scraps
/use Borean Leather scraps
/use Borean Leather scraps
/use Borean Leather scraps
/use Borean Leather scraps
/use Borean Leather scraps
This is also easily accomplished by simply putting your stack of Borean Leather Scraps on a hotbar button, and clicking the item as you would when using a scroll or a potion. It's not affected by the Global Cool-Down, so you can spam it as well. An advantange to using this method is that you will not only be shown you how many Scraps you have in your bags/containers, but it will accomplish the same task without actually using one of your available macro slots.
As an alternative, you could make something like
/use Jaggal Clam
/use Thick-shelled Clam
/use Big-mouth Clam
/use Borean Leather scraps
/use Darkwater Clam
/use Crystallized Air
/use Crystallized Earth
/use Crystallized Fire
/use Crystallized Life
/use Crystallized Shadow
/use Crystallized Water
To easily open clams and combine a variety of combinable items.
One advantage is that you can use the macro while having the bank screen opened.