I am not in front of Maya, so I may be wrong on this but its worth a try. If 
you place that code in the userSetup.py file it will be executed before any of 
the Maya GUI is built. Instead, look up the executeDeferred command, then pass 
what you have there as a string argument.

executeDeferred makes maya queue the command up and it will be executed only 
when Maya first becomes idle ( which in your case will be after Maya has fully 
loaded ).

From: PBLN RAO <[email protected]<mailto:[email protected]>>
Reply-To: 
"[email protected]<mailto:[email protected]>"
 
<[email protected]<mailto:[email protected]>>
Date: Monday, 1 October 2012 08:43
To: 
"[email protected]<mailto:[email protected]>"
 
<[email protected]<mailto:[email protected]>>
Subject: [Maya-Python] How to disable OPen,Save & SaveAs in Maya

Hi i am trying to disable the Open,Save & SaveAs items from File Menu and icons 
on Status Line.

I am able to disable the file menu items by below code.

import maya.cmds as mc

mc.menuItem('openProject',e=1,en=0)

mc.menuItem('saveItem',e=1,en=0)

mc.menuItem('saveAsItem',e=1,en=0)


but i want it to run at maya start-up (may be something like UserSetup.py)


The problem is the above code is not working after launching maya.


it gives errors as below


import maya.cmds as mc

mc.menuItem('openProject',e=1,en=0)

# Error: RuntimeError: menuItem: Object 'openProject' not found. #

mc.menuItem('saveItem',e=1,en=0)

# Error: RuntimeError: menuItem: Object 'saveItem' not found. #

mc.menuItem('saveAsItem',e=1,en=0)

# Error: RuntimeError: menuItem: Object 'saveAsItem' not found. #


but if i click the file menu once and use the commands, then it will work 
perfectly.

So how can i make this to work at maya launch/startup.


There is no chance of editing the maya files form installation path. as it has 
to be implemented all over my studio.

--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to