There are two main ways (there are many more, but the result's the same) of running scripts in Maya, whether they are MEL or Python.
First paste or open the script in the Scripts Editor, then:
- To run directly from the Editor, select all the script text, then press Ctrl-Enter, or the NumPad Enter.
- To add to a shelf, select all the script text, then drag and drop it to your shelf (with Ctrl pressed if you want the script to remain in the editor). Tell Maya in which language the script is. Then right-click on the new button and Open. Rename it on top of the Shelf Contents tab, give it an Icon Label or find a better suiting icon by clicking the Maya icon on the right of Icon Name !
|An example of icon for my Instancer script|