Hey all. This document will be designed to teach people how to use macros for a wide range of uses. I plan to start with the absolute basics and make it progressively more complicated (probably with better organization as it gets longer). Therefore, if you find you already know everything I'm talking about, you might as well scroll down a while (assuming that I've gotten that far). Also I use the default UI, so there might be some differences in how you get to your macro window, or what may be considered necessary/unnecessary scripting.
For starters, a macro is a command or chain of commands you use to complete one or more tasks. Simple macros can be very simple, while complicated ones can do a long series of actions with a single click. There are two ways to access the macro window. First you can type /macro. The other way is to click on the chat bubble in the top left of your chat box (where all of the text appears when you're chatting with people) and choose macro (at the bottom). From here, you can choose to make new macros, or edit ones you already have. You can also choose to work with generic ones, or character specific ones (see the top of the macro window). For example, lets say you have a mage and a rogue toon. Some of your mage macros might not be of any use to you when you play your rogue, so you can store these in the second tab (at the top of the macro screen) when on your mage. They wont show up when you play any other character, and this allots you much more space than if you just put everything in the all character's tab.
To create a macro, first open the macro window (see previous paragraph), click the new macro button in the center of the macro screen. You'll have to name it and choose an icon (picture). All of this can later be changed if you want at any time. For starters, lets name your new macro: Talking. Choose any icon you wish, and then click OK. Now, in the bottom of the macro window you should have space to type in the code for your new macro. You are limited to 255 characters, but generally this wont be a hindrance. Inside the large box at the bottom type "/say Macro Test". Now hit the escape key once. Hitting the escape key brings you out of the code box, and your macro is automatically saved. If you accidentally hit the escape key twice, type /macro to open the macro window again. Now, on the top of the macro window where you see the icon you chose, drag that icon to somewhere on your bar. Click the icon which is now on your bar. You should notice that your character said "Macro Test" as if you had typed it yourself in chat. You can play around with this as you with with several varieties such as /yell, /g (guild chat), /w *person's name*, /r (respond), /1 (or any other number for chat channels), /em (emote), etc. Please note that if you double click this chat macro icon, it'll say it twice and so on, so be careful with accidentally (or intentionally) spamming people.
You can also modify this to do various emotes. In addition to something such as "/me runs around like a moron" (shows on the screen as *your name* runs around like a moron), you can also do preprogrammed emotes. For example, "/dance" dances, "/train" whistles like a train, "/spit" says that you spit on your current target, and so on. Instead of your macro saying "/say thats funny", you could just do "/laugh", and so on.
Moving on to a slightly more practical, but still simple concept, is /target. You will eventually find that target is a very useful feature in macros. Create a new macro and name it Target. For the basics of targeting, find a player or npc near you, and create "/target *their name*" as a macro. You will notice, that if you were not targeted on it already, when you click this macro you will be. Furthermore, lets say you aren't sure of the exact name of the target you want, or you are too lazy to type in the long complicated names some things have. The /target comparison goes in order of left to right on their name. In other words, if you want to target Thrall (assuming that you are near him), and you type "/target thralQ", it will probably still target Thrall because both Thrall and your macro share the first four letters. However, if you type "/target hrall", it will not target him, because it will look for something which starts with the letter 'H' only. Even at this simple stage this can be useful for many things. If you are in warsong gulch, and you see PrettyBoy has captured the flag, then quickly type /macro, find your target macro, and change it to "/target pret", and use this to try to find him. Also, if youre doing a quest and you see you need to kill King Yeti, go into your macros and change your target macro to "/target King Yeti". When you click on this, if nothing with the same first letter is near you, you will not get a new target. Or, if something with a similar beginning to your target (such as Kinsfolk vs King Yeti both start with kin), you will target on that until something which shares a longer series of the first letters appears close enough to you. Therefore, clicking this /target macro frequently when looking for something will tell you if you are even remotely close to it (even if you dont notice it yet).
As an added tip, I name my targeting macro aaatarget. The reason for this is as follows. Your macros are automatically organized alphabetically. When you type /macro the first one is loaded up, and thus is the fastest to modify. Since I want to modify the person my target macro is targeting to quickly sometimes (also I use this macro a lot), the added speed of not having to find it in my list of macros helps. You'll notice that Target is alphabetically after Talking. So in your macro window Target is the second macro. Click the target macro and click change name/icon and rename it aaatarget. Now hit ok, and you'll notice that aaatarget is before Talking now. If you dont like it being called aaatarget, you can always change it back.
Next we'll start multiline macros, while still keeping it as simple as before. A multiline macro is the same as multiple macros crammed into one. Making a 2 line macro is no different than making two 1 line macros and clicking them immediately after each other. You'll find that basic multiline macros will run each line so quickly that all lines are run within the same second. The reason for making a multiline macro is because you can add a much greater degree of complexity to what your macro does, and only have to push 1 button to do it.
Lets try one. Open your macro page and click the icon for the Talking macro we made earlier. If you deleted it, you can create a new one. Delete the text inside the script box at the bottom and enter this in:
"/say I'm just talking to myself" (press the enter key)
"/say Why are you still reading this "
Go ahead and try it out. You'll notice that even though you had two /say lines, they both appeared in the chat as though you had said the first and then immediately said the second.
Now lets try something with a little more practicality.
"/target (the name of something nearby)" (don't include the parenthesis. Press the enter key)
"/say Targeted on %t" (type this line exactly as I wrote it)
When you run this macro, it does two things. First it switches your target to something you programmed in. Second, it says in /say "I am targeted on (and then the name of that target). %t is a function commonly used where it automatically replaces the characters "%t" with the actual name of the target you have currently. You can find this to have several uses when we get into more complicated macros. For example, if you have a discipline priest, you can make a macro to say "Power Infusing %t" before casting power infusion. That way the person you power infuse knows to go crazy on his damage before the buff wears off. The same concept goes for druids with "Innervating %t" or "Combat Rezzing %t" and so on with other classes and abilities. (Once again remember that if you use macros for chatting too much it can get very annoying to anyone in your group). This is just one of many things you can do with multiline macros and %t.