Reputation: 159
I try to make a batch file that basically opens all the stuff I need to work. Opening Maya is quite simple, but there's one step further i'd like to do: make it open my last opened file. if i understand the doc Start Maya from the command line
I could try this:
path/to/maya.exe -command [some MEL commands that may open the last opened file]
But I have no clue how to MEL and I guess for it to work as a windows batch I must keep it as one command line. I try to read the docs but I fail to find anything I can make use of.
python("recent = cmds.optionVar(q='RecentFilesList')[-1]; cmds.file (recent, force=True, open=True)")
Issues:
Thanks to this answer:
force=True
in cmds.file (recent, force=True, open=True)
to force the file command to work without the need to save the file first\
before the commands "
to properly parse them to Maya"path\to\maya.exe" -command "python(\"recent=cmds.optionVar(q='RecentFilesList')[-1]; cmds.file (recent, force=True, open=True)\")"
Upvotes: 0
Views: 849
Reputation: 1978
Usually you replace a " with a \" to get a working mel command. So if you this could work:
"python(\"recent = cmds.optionVar(q='RecentFilesList')[-1]; cmds.file (recent, open=True)\")"
But to be honest I did not test it as a commandline argument.
You can modify the file command with force:
cmds.file(recent, force=True, open=True)
Upvotes: 1