Originally Posted by
WoW Wiki macro Guide
Simulating button clicks
The /click command takes the name of a button and acts like you clicked the button with your mouse. By default, it behaves like a left-click, but you can specify other mouse buttons in the command. There are a few ways to determine the name of the frame you're interested in:
* You can use an addon. Some addons, including MoveAnything, give you a way to see the name of the frame underneath your mouse.
* You can look through the UI code for the frame. This is really only applicable to people who are comfortable with addon programming.
* You can bind the following macro by a key and then run it while your mouse over the frame in question:
/run local f = GetMouseFocus(); if f then DEFAULT_CHAT_FRAME:AddMessage(f:GetName()) end
/click can be used for many different purposes. You can chain together multiple macros by /click'ing buttons with other macros on them. For example, you might have a really long macro that doesn't fit into 255 characters. Put as much of it as you can in one macro and end it with the following line:
/click MultiBarRightButton1
The rest of the code would go into a new macro that you would then place on MultiBarRightButton1 (the first button of the right-hand vertical extra action bar).
You can also do things that normally wouldn't be available to macros. For instance, turning on auto-cast for a pet spell can't be done by Lua scripts and there isn't a secure command for it (until the next patch, at least). However, you can write a macro to pretend that you right-clicked on one of your pet bar buttons:
/click PetActionButton5 RightButton
This command will act like you right-clicked the 5th pet button from the left. The extra button parameter can also be LeftButton (the default), MiddleButton, Button4, or Button5.
On top of these uses, there are some more complex examples of /click branching towards the end of Part II.
Action bar button names
As shown above, MultiBarRightButton1 refers to the first button of the right-hand vertical extra action bar. MultiBarRightButton2 refers to the second button, and so on. Names for buttons on each of the standard action bars are as follows, replacing the # with an appropriate number:
ActionButton# Main Bar*
BonusActionButton# Dynamic bar that switches actions based on Druid Forms, Warrior Stances, and Rogue Stealth*
MultiBarBottomLeftButton# Bottom Left Bar
MultiBarBottomRightButton# Bottom Right Bar
MultiBarRightButton# Right Bar
MultiBarLeftButton# Right Bar 2 (to the left of "Right Bar")
PetActionButton# Pet Bar
ShapeshiftButton# Druid Forms, Paladin Auras, Warrior Stances, Death Knight Presences, Rogue Stealth
* The BonusActionBarFrame frame replaces the ActionBarFrame frame for all Druids, Warriors, and Rogues and /click ActionButton# and /click BonusActionButton# do the same thing for these classes.