Introduction to Maya - Rendering in Arnold
This course will look at the fundamentals of rendering in Arnold. We'll go through the different light types available, cameras, shaders, Arnold's render settings and finally how to split an image into render passes (AOV's), before we then reassemble it i
# 1 04-03-2006 , 02:58 PM
Registered User
Join Date: Mar 2006
Posts: 3

How to make Maya Menu Call extern program

i'v edited a mel script to add a menu to maya 6.5 on its startup.

what i want to know it that how can i Execute a external windows program
(for example, MS Word,or one written by myself) by clicking
the menu item.

can mel do this?
what about Maya API?

Who can help me?

thank you very much!

# 2 04-03-2006 , 04:30 PM
skywola's Avatar
Registered User
Join Date: Jan 2004
Location: Tempe, Arizona, USA
Posts: 224
system("start C:/WINNT/NOTEPAD.EXE" );

Directly from the Maya reference library . . . keywords . . ."system command" . . .


"The Sage as an Astronomer: If you still see the stars as something above you, you lack the eye of knowledge." Friedrich Nietzsche
# 3 06-03-2006 , 04:14 PM
Registered User
Join Date: Mar 2006
Posts: 3
thank you !
but i still met some problem.....

it did work if i type

system("start c:\xxx\xxx.exe") in script editor

but when i put this command in my menu .mel script
like this:

global string $gMainWindow;
setParent $gMainWindow;

menu -label "Farrender";
menuItem -label "start Clent" -command "system("start c:\\xxx\\xxx.exe")";

it would even make the menu fail to create;

i thought i must be the string problem after "-command"

so i changed the last line to:

menuItem -label "start Client" -command "system(\"start c:\\xxx\\xxx.exe\")";


this time ,menu create successfully!
but when i click the menu item "start Client"
nothing happen!
no error information.....no effect...

i 'm puzzled

any kind man or woman who can help me?


Last edited by zhvirus; 06-03-2006 at 04:16 PM.
# 4 06-03-2006 , 08:39 PM
skywola's Avatar
Registered User
Join Date: Jan 2004
Location: Tempe, Arizona, USA
Posts: 224
This is just a guess. because I do not have the code to try it out, but I would try this:


string $startExe = "system(\"start c:\\xxx\\xxx.exe\")";

menuItem -label "start Client" -command $startExe;


or if that does not work you might try:

string $startExe = "system(start c:\\xxx\\xxx.exe)";

menuItem -label "start Client" -command $startExe;


The backslash does not look right, it may have worked, but it looks more correct in the last example I listed. It may not even be needed.

Working with strings is a lot of fun . . . :headbang: Best bet when you get into trouble with ANY Maya commands is refer to the reference library or look online for example code.


"The Sage as an Astronomer: If you still see the stars as something above you, you lack the eye of knowledge." Friedrich Nietzsche
# 5 07-03-2006 , 05:51 AM
Registered User
Join Date: Mar 2006
Posts: 3
haha
i understand now

when we type directly in script editor

we type:
c:\\xxx\\xxx.exe

so in string we'd type like this

c:\\\\xxx\\\\xxx.exe

thank you for your help :attn:

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads