ofcourse you should be executing those commands in the script editor.If you want the menu to be loaded every time you run maya, then you need to save the script in
MyDocuments>maya>version>scripts and also include the line
Code:
source "your script name.mel";
in the
userSetup.mel in the same directory.If the script doesn't exist create one and save it in the same path
Code:
global proc myMenu()
{
global string $gMainWindow;
global string $MyMenuObj;
if (`menu -exists $MyMenuObj`)
{
deleteUI $MyMenuObj;
}
string $name = "My Menu";
$MyMenuObj = `menu -p $gMainWindow -to true -l $name`;
menuItem -p $MyMenuObj -l "axmesh" -c ("your command ");
}