Run, hide call 911. Run, and get out of the building if you can. Hide behind locked doors if not. Hide behind furniture, crouch - bullets that ricochet tend to travel along the floor, so being up in a ball minimizes your exposure to those. If you can get out of the building, keep your hands where they can be seen. Listen and follow instructions from e- responders. Call 911 and tell them what you have seen.
Action plan. Your school should have an action plan to deal with various types of crisis: natural disaster, fire, and, sadly, violent attacks. Students should be aware of the plans and practice them on an annual or semi-annual basis. There is no perfect way to deal with a violent attack - each attacker is different and the physical layout of the schools are different - but preparation helps ease the mind.