View Full Version : need help with Windows compatibility
cgbeige 06-19-2011, 05:11 PM This output works from the command prompt but not from within Maya:
string $basedir = `workspace -q -rd`;
system ("start " + $basedir + "images");
I just want to have Windows desktop Explorer open the folder, the same as system ("open " + $basedir + "images"); works on OS X
|
|
NaughtyNathan
06-19-2011, 10:30 PM
If $baseDir contains spaces it will need quoting (escaped of course).
system ("start \"" + $basedir + "images\"");
also, I do this somewhere in one of my scripts but I don't just do "start $path", I use "start explorer file://$path" not sure if it makes any difference..?
:nathaN
cgbeige
06-20-2011, 02:30 AM
it's the weirdest thing - if you run the results in the command prompt, it works but from maya, nothing. I can't figure it out
cgrebeld
06-20-2011, 06:46 AM
You can try python instead:
import os
from maya import cmds
basedir = cmds.workspace(q=True,rd=True)
os.startfile(basedir)
cgbeige
06-20-2011, 09:18 PM
awesome, thanks. so this works but how do I call this from within an if about -win in MEL?
import os
from maya import cmds
basedir = cmds.workspace(q=True,rd=True)
os.startfile(basedir + "images")
cgrebeld
06-20-2011, 10:54 PM
From MEL, you can use the python command:
string $basedir = `workspace -q -rd`;
string $pycmd = ("import os;os.startfile('" + $basedir + "');
python($pycmd);
CGTalk Moderation
06-20-2011, 10:54 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.