Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Maya Technical Issues (https://simplymaya.com/forum/forumdisplay.php?f=23)
-   -   How to make Maya Menu Call extern program (https://simplymaya.com/forum/showthread.php?t=20486)

zhvirus 04-03-2006 02:58 PM

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!

skywola 04-03-2006 04:30 PM

system("start C:/WINNT/NOTEPAD.EXE" );

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

zhvirus 06-03-2006 04:14 PM

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?

skywola 06-03-2006 08:39 PM

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.

zhvirus 07-03-2006 05:51 AM

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:


All times are GMT. The time now is 04:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018