I do not believe you can change gear in combat. You can tell if you are in combat if there are 2 crossed swords next to your portrait where your level usually is.
Eej, no warrent for the sarcasm there. Simply, have you looked at some of the other macro posts? It makes it seem very difficult and it's code. Since I don't code it seems pretty overwhelming to bother with the macro system.