need help with Windows compatibility

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 06 June 2011   #1
need help with Windows compatibility

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

Last edited by cgbeige : 06 June 2011 at 09:22 PM.
 
Old 06 June 2011   #2
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
 
Old 06 June 2011   #3
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
 
Old 06 June 2011   #4
You can try python instead:
import os
from maya import cmds
basedir = cmds.workspace(q=True,rd=True)
os.startfile(basedir)
 
Old 06 June 2011   #5
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")
 
Old 06 June 2011   #6
From MEL, you can use the python command:

string $basedir = `workspace -q -rd`;
string $pycmd = ("import os;os.startfile('" + $basedir + "');
python($pycmd);
 
Old 06 June 2011   #7
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 08:58 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.